File Format Conversion and compression through window command.

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Jiyahana
Newbie
Posts: 10
Joined: Thu Jan 18, 2024 10:03 am
Location: India
Contact:

File Format Conversion and compression through window command.

Post by Jiyahana » Mon Feb 19, 2024 8:31 am

Hello everyone,

Transforming images from one format such as JPEG, PNG, GIF, etc. to another. I got a png file image which is size in 8MB, the picture taken from the satellite, and I want to keep that image in smaller size for that I'm using online application such as jpeg compressor for compressing images it is good in image compression but I want to do this, through the windows command and also I want that it will convert file format from png to svg or jpeg through the windows command is it possible. Do you have any suggestion or recommendation it will appreciate.
Thank you.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: File Format Conversion and compression through window command.

Post by Dorian (MJT support) » Mon Feb 19, 2024 8:45 am

I'd investigate using ImageMagick via the command line with RunProgram.

I can't give specific ImageMagick examples to do this, but I'm fairly sure it would be able to do what you need.
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: File Format Conversion and compression through window command.

Post by Dorian (MJT support) » Mon Feb 19, 2024 8:51 am

Yes, we have a Custom Scripting Service. Message me or go here

Jiyahana
Newbie
Posts: 10
Joined: Thu Jan 18, 2024 10:03 am
Location: India
Contact:

Re: File Format Conversion and compression through window command.

Post by Jiyahana » Mon Feb 19, 2024 10:28 am

Dorian (MJT support) wrote:
Mon Feb 19, 2024 8:51 am
This might get you started : viewtopic.php?f=3&t=10590&hilit=Imagemagick#p45051
Thank you very much for you recommendation I'm going to try this if this will work surly I'll let you know.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: File Format Conversion and compression through window command.

Post by Dorian (MJT support) » Mon Feb 19, 2024 11:55 am

I'm no expert on ImageMagick but managed to cobble this together, which will take Untitled.png and create Untitled.jpeg. I installed ImageMagick first.

Code: Select all

let>FilePath=C:\Path\To\Images
let>filename=Untitled.png
let>filenameout=Untitled.jpeg
let>IMPath=C:\Program Files\ImageMagick-7.1.1-Q16-HDRI\magick

Let>IMcommand=convert "%filepath%\%filename%" "%filepath%\%filenameout%"
RunProgram>%IMPath% %IMcommand%
And just as in the thread I linked to, this can be adapted to work in a loop and perform the same operation on every png in a folder.
Yes, we have a Custom Scripting Service. Message me or go here

jonathangoss
Newbie
Posts: 9
Joined: Fri Sep 07, 2012 8:41 am
Location: Bournemouth

Re: File Format Conversion and compression through window command.

Post by jonathangoss » Thu Feb 29, 2024 3:06 pm

agree with Dorian there. We use the following in a loop to covert multipage tiff to PDF:

runprogram>%ImageMagikLocation%convert %varImageMagickFileNames% %workingDir%\%varOriginalFileName%
TimeStamp>%LogFileName%,RP_RESULT is %RP_RESULT% with ZERO being successful
wait>2
SetDialogProperty>Dialog22,Label2,Caption,Ran ImageMagik
wait>2
Jonathan

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts