Convert any image type to jpg

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.

Mac, Win, Linux or multiples?

For Mac only I use “sips” (scriptable image processing system) . For Win and Linux I use ImageMagick.

Edit: Beaten by James!

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.

i want to do for both mac and windows

[quote=342926:@James Meyer]Mac, Win, Linux or multiples?

For Mac only I use “sips” (scriptable image processing system) . For Win and Linux I use ImageMagick.[/quote]

is there mac version of imagemagick??

Load the picture, and save it as Jpeg…

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)

Completely forgot that was possible.

https://documentation.xojo.com/index.php/Picture.Save

Just did a quick test - had no issue loading a TIFF and saving as a JPEG, on Mac and Windows.

That is what I do in my Watermark software.

On Mac, MBS is needed to save GIF and TIFF, but Jpeg is just fine native.

[quote=342938:@Michel Bujardet]That is what I do in my Watermark software.

On Mac, MBS is needed to save GIF and TIFF, but Jpeg is just fine native.[/quote]

don’t need mbs for tiff.