Page 1 of 1

Resize AND convert *.jpg to *.png possible in one command?

Posted: 2020-02-27T23:02:16-07:00
by bensto
I have *.jpg pictures which I can resize successfuly with a command similar to:

convert myorigpic.jpg -resize 1280x -quality 97 myresizedpic.jpg

Is there a way to (lossless) convert (in the same command!) the JPG format to PNG (immediately after the resize operation)?
Or are there two command necessary?

How would such a command look like?

Ben

Re: Resize AND convert *.jpg to *.png possible in one command?

Posted: 2020-02-27T23:09:35-07:00
by fmw42
Not sure what you want to do, but this will take the decompressed jpg from the read, resize it and save it to png without losslessly recompressing in jpg format. It will be compressed to png format, but that is lossless.

Code: Select all

convert myorigpic.jpg -resize 1280x myresizedpic.png

Re: Resize AND convert *.jpg to *.png possible in one command?

Posted: 2020-03-02T23:07:39-07:00
by bensto
Danke.

Wird zuerst das Resize durchgeführt und dann das convert JPG--->PNG oder umgekehrt?

Ich könnte mir vorstellen, dass eine Konvertierung zunächst in PNG und dann erst das Resize ein besseres Ergebnis erzietl

Re: Resize AND convert *.jpg to *.png possible in one command?

Posted: 2020-03-03T10:25:48-07:00
by fmw42
The command that I provided simply reads the input jpg and decompresses it into a 24-bit color image. Then it resizes it. Then it saves to PNG with lossless compress. If you want to go to JPG, it will not matter whether you use intermediate PNG or not. The quality will be lost by the writing of a new PNG due to the lossy compression.