I'm using im4java to call imagemagick from a grails app. The command line I'm trying to get it to use is
convert "c:\ZonesG\web-app\spresources\summarypage_images\00\09\18\myimage.jpg" -resize 100x100 "c:\ZonesG\web-app\spresources\summarypage_images\00\09\18\myimage_thumbnail100.jpg"
or
convert c:\ZonesG\web-app\spresources\summarypage_images\00\09\18\myimage.jpg -resize 100x100 c:\ZonesG\web-app\spresources\summarypage_images\00\09\18\myimage_thumbnail100.jpg
The args passed to ProcessBuilder look correct. There are 5 separate Strings as follows.
convert
c:\ZonesG\web-app\spresources\summarypage_images\00\09\18\myimage.jpg
-resize
100x100
c:\ZonesG\web-app\spresources\summarypage_images\00\09\18\myimage_thumbnail100.jpg
I get an error that the -resize parameter is not valid when I run it through processbuilder. That makes it seem as if it is calling the convert function, but something has happened to the parameters so that it no longer recognizes them. It's not the hypens in the directories. I tried it to different directories and it still doesn't work.
When I run it from the command line it works perfectly.
I've tried adding double quotes around the two file names. Again it works great in the command window but doesn't work from the java code.
Any Ideas?
Thanks for your comment Jonathan,
Meanwhile, I discovered what was happening.
The order of the args mattered more when calling from the ProcessBuilder. I changed it so that the resize and geometry are first and the input image file is next. That made it work.
I had this error too. It is actually because it is running a program from Microsoft in Windows called "convert". To get im4java to run the correct you need to make an environment variable. Eg: IM4JAVA_TOOLPATH=C:\Program Files (x86)\ImageMagick-6.6.4-Q16\
Related
I am using the SImpleITK and ipython notebook for image processing and as we know imagej is the default image viewer in simpleitk. But the type of image i am using is .mha and .mha is not supported by imagej. For this I have to use fiji or imagej2.
I have tried to make fiji as a default image viewer according to the instruction mentioned in simpleitk FAQs but did not get success and show the following message:
I want to know what mistake I am doing .
How to make Fiji or imagej2 as a default image viewer for all types of images when I work with simpleitk and ipython notebook.
Thanks.
Looks to me like you still have ImageJ in your STIK_SHOW_COMMAND variable which is not found in your fiji folder.
Read the instructions again. I assume you did not follow them well enough. Your variable should contain the new image viewer and no ImageJ in a different folder.
Try to change the extension of the file with the system variable SITK_SHOW_EXTENSION and try to provide the command to the visualisation software with SITK_SHOW_COMMAND.
In my .bash_profile I have:
export SITK_SHOW_COMMAND='itksnap'
Other instructions can be obtained with ?sitk.Show() .
Try changing the "%F" to "%f". It is case sensitive. Or actually, you can just leave it off. If there is no "%f" it will just put the file name at the end of the command line.
Also, you can use SimpleITK/ImageJ to view MHA files. SimpleITK actually writes out a Nifti file by default when Show is called, regardless of the input image.
This seems so trivial, but I can't figure out why the parameters I'm passing into a .ps1 script from the command pane aren't getting captured correctly as shown in this image below. String parameters are just empty, numbers are 0 which tells me I've overlooked something basic! This is with Powershell v2.
Thanks mklement0.
It was, in fact, a path issue within the ISE
I am using Matlab to produce publishable graphs and have encountered problems with the print function for the first time despite having used it identically before. I can't figure out why it has stopped working.
When I run my script with
print(1,'-djpeg','My_Figure','-r300')
at the end, the results is a file that is a document type, not a jpeg.
Has anyone encountered this before or have any ideas why this might be happening?
As discussed within the comments->
One can try to append the file-extension:
print(1,'-djpeg','My_Figure.jpeg','-r300')
As this is documented different:
If filename does not include an extension, print appends an appropriate extension.
TMW: print
..it seems to depend on either the Matlab-Version or the OS Matlab is running on.
I am using ghostscript to print a pdf by command line arguments in c#. but it shows the printed document's name as ghostScript output. I want to change it to a custom name(as letter's name). I know in command line parameters, it does not allow to change it. please help.
I'm sorry, I really don't understand what you're asking. You specify where Ghostscript should write it's output using the "-o" or "-sOutputfile=" command line parameters. The name of the input file does not influence the output file.
Unless you are using something like ps2pdf.....
If you can clarify what you are trying to do, I or someone else can likely help.
Chris
It looks like ImageMagick does not always convert a single favicon.ico file to a predictable single png file - for some favicon's, it generates a bunch of other favicon-01.png, favicon-02.png, etc... Is there a way to figure out which one's the actual converted favicon you want - or figure out how many got generated, to delete the unwanted ones?
I came across with the same problem while I was trying to convert blogger's favicon and I solved it by using -flatten parameter of Imagemagick like this:
convert "favicon.ico" -thumbnail 16x16 -alpha on -background none -flatten "favicon.png"
This likely happens because there are multiple images in the icon file - this is to provide differet resolutions for different contexts. Presumably you'd want to run a search in the target directory for favicon*.png, then check the dimensions of each one to find the one you wanted (deleting the others as you go).
I guess some of these are animated gifs. You can take the first one as described here:
http://www.imagemagick.org/script/command-line-processing.php
i.e.:
$magick> convert 'images.gif[0]' image.png
I don't have ImageMagic installed, but you might try the above for all favicon.ico, it might work fine.
Otherwise, you would probably need to write a script to check for favicon-01.png and, if it exists, rename it to favicon.png and delete favicon-*.png (provided you don't have anything else named like that in the working folder).