I am working on a feature for my application. currently i only allow jpg image to be include in my application. Basically the user select an jpg image from a folder and it get copy to a share image folder called ASImages and at the same resize to smaller image with 1024 pixel, either width or height based on portrait or landscape.
Now, i want to be able select any image type mainly tiff or png and convert it to jpg. it will then do the other thing after converting the image.
I know i can use GraphicMagick but can’t find the method to use for converting.
Hi Richard, if you are targeting Windows, you can ignore the rest of my post.
But if you’re targeting Mac or Linux, you can do this with a built-in tool called sips. Create a Shell and run something like the following example:
sips -s format jpg input.tiff --out output.jpg
You could even ask sips to check its width and height, thus checking if it’s portrait or landscape, and use the -z flag to resize it, again all in one line.
What Michel said… however if I recall… you cannot loa/save GIF or TIFF without using SIP… I had this issue with DSPaint a few years back, and that is what I seem to recall, but to convert PNG<->JPG… just load it and save it again with the new type (see PICTURE.SAVE)