Page 1 of 1

Resizing png jpg gif to jpg without quality loss

Posted: 2015-05-05T08:01:15-07:00
by mastermind1981
Hi,

I want to convert differents images with different types ( png, jpg and gif) to resized images with jpg type (i may swith to another type to gain in quality ).

I want to resize to create a mid sized image 500x350 and thumbnails 200x150 the problem is the result image for thumbnails is really poor.

here is the command i use for mid size image:

Code: Select all

convert kettle.png -resize '500x350'!   -quality 100  ketlle500x350_.jpg
Here is http://pngimg.com/download/8732 the source image and the results are here:

500x350 https://app.box.com/s/gla6spaskxti4rdmfiru50v4acimq35m

200x150 https://app.box.com/s/1290welaigq79ttbgk04bv2rzw4ko7bt

As you can see the quality is not very high. Any help would be appreciated.

Thank you in advance.

Re: Resizing png jpg gif to jpg without quality loss

Posted: 2015-05-05T08:26:00-07:00
by glennrp
Compose against the background before resizing:

Code: Select all

convert kettle_PNG8732.png -background black -flatten -resize '200x150'! -quality 92  kettle200x150_flattened.jpg

Re: Resizing png jpg gif to jpg without quality loss

Posted: 2015-05-05T08:36:37-07:00
by mastermind1981
that's better but is there anyway to have much better quality?

Re: Resizing png jpg gif to jpg without quality loss

Posted: 2015-05-05T09:47:00-07:00
by fmw42
This is a terrible site for downloading. It is very slow (unless you pay for downloading) and pushes unwanted pop-up adds on you.

Still waiting for the download to finish, before I can analyze your image. But my guess is that it has a white border around the image that does not show when overlaid or flattened to white background. You need to remove the excess area in the alpha channel and then feather it some. Perhaps use -morphology erode.

Re: Resizing png jpg gif to jpg without quality loss

Posted: 2015-05-05T09:53:32-07:00
by fmw42
The download was a whole file of images. What is the name of the file corresponding to what you are working with. I do not see kettle_PNG8732.png in your download folder.

Never mind. I finally found the button to download only the one image.

Re: Resizing png jpg gif to jpg without quality loss

Posted: 2015-05-05T10:20:17-07:00
by fmw42
If this is an issue of sharpness, then try either

Code: Select all

convert kettle_PNG8732.png -background black -flatten -filter catrom -distort resize '200x150'! -quality 92  kettle200x150_flattened.jpg
or

Code: Select all

convert kettle_PNG8732.png -background black -flatten -filter catrom -distort resize '200x150'! -unsharp 0x0.5 -quality 92  kettle200x150_flattened.jpg

Re: Resizing png jpg gif to jpg without quality loss

Posted: 2015-05-05T10:35:44-07:00
by mastermind1981
@fmw42 Thank you it's much better with

Code: Select all

convert kettle_PNG8732.png -background black -flatten -filter catrom -distort resize '200x150'! -quality 92  kettle200x150_flattened.jpg