Generated Image renditions are getting cropped

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
sujeetpalepu
Posts: 2
Joined: 2017-09-20T09:08:29-07:00
Authentication code: 1151

Generated Image renditions are getting cropped

Post by sujeetpalepu » 2017-09-20T09:25:36-07:00

Hi team,

We are using the Image magik for generating the renditions of the image in our platform. We have updated the quality factor to 75% from 85% and we see the renditions generated are getting cropped. Is there a way we can set the quality percentage to 75% and still make sure that the generated renditions are not cropped.

Here is the command that we are using now for which the renditions are getting cropped.

Existing command: {{-sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace RGB }}
Updated command: {{-sampling-factor 4:2:0 -strip -quality 75 -interlace JPEG -colorspace RGB }}


It would be of great help if you anyone can let us know how to handle this.

User avatar
fmw42
Posts: 22095
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Generated Image renditions are getting cropped

Post by fmw42 » 2017-09-20T09:28:08-07:00

Please provide your IM version and platform and the full exact commands you are using. Also provide and example input image. Why are you using -colorspace RGB? On current IM versions that is a linear colorspace and will appear darker. Are you on a very old IM system where RGB was non-linear?What type image are you starting with. Have you tried adding +repage after reading the input image?

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at viewtopic.php?f=1&t=9620

For novices, see

viewtopic.php?f=1&t=9620
http://http://www.imagemagick.org/scrip ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/

sujeetpalepu
Posts: 2
Joined: 2017-09-20T09:08:29-07:00
Authentication code: 1151

Re: Generated Image renditions are getting cropped

Post by sujeetpalepu » 2017-09-20T13:11:12-07:00

Hi Team,

Please find below the details requested.

Code: Select all

Platform :  Adobe Experience Manager 6.2 SP1
Image Magik Version -  ImageMagick 6.9.0-10 Q16 x86_64 2015-05-20
Command used to generate the rendition: mpr:image -resize '1082x547^' -gravity center -crop 1082x547+0+0 -quality 75 -write cq5dam.web.1082.547.jpg +delete
Source Image format - jpg
Source Image dimension - 1500x1000
We are generating the rest of the renditions as mentioned below with the quality factor as 75 percentage and they are getting generated fine.

Code: Select all

mpr:image -resize '237x158^' -gravity center -crop 237x158+0+0 -quality 75 -write cq5dam.web.237.158.jpg +delete \
mpr:image -resize '237x237^' -gravity center -crop 237x237+0+0 -quality 75 -write cq5dam.web.237.237.jpg +delete \
mpr:image -resize '237x300^' -gravity center -crop 237x300+0+0 -quality 75 -write cq5dam.web.237.300.jpg +delete \
mpr:image -resize '424x424^' -gravity center -crop 424x424+0+0 -quality 75 -write cq5dam.web.424.424.jpg +delete \
mpr:image -resize '512x203^' -gravity center -crop 512x203+0+0 -quality 70 -write cq5dam.web.512.203.jpg +delete \
mpr:image -resize '512x341^' -gravity center -crop 512x341+0+0 -quality 70 -write cq5dam.web.512.341.jpg +delete \
mpr:image -resize '640x490^' -gravity center -crop 640x490+0+0 -quality 75 -write cq5dam.web.640.490.jpg +delete \
mpr:image -resize '640x580^' -gravity center -crop 640x580+0+0 -quality 75 -write cq5dam.web.640.580.jpg +delete \
We are not using the color space. It was my bad. Please refer to the above commands.

Regarding the source image, is there a way that i can share the image with you as the source image is never exposed on our site.

snibgo
Posts: 9392
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Generated Image renditions are getting cropped

Post by snibgo » 2017-09-20T13:46:29-07:00

sujeetpalepu wrote:Is there a way we can set the quality percentage to 75% and still make sure that the generated renditions are not cropped.
The images are being cropped because your commands contain a "-crop" operation.
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 22095
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Generated Image renditions are getting cropped

Post by fmw42 » 2017-09-20T14:57:09-07:00

Those are not valid commands. For IM 7 you need an input and output image and the command must start with magick.

When we ask for a full command line, we expect to see the whole line not just the arguments, especially when you are using multiple lines of code. This is important to make sure your syntax is proper and what IM command you are using. Also to know if you are using multiple command lines or one long command line.

It would be most helpful if you provide an example input and output image with the exact command that produces the problem. That way we can test your command with your images. You can upload your images to any free hosting service that will not change the image format, such as dropbox.com and post the URL(s) here.

Typically after a crop, you should add +repage to remove the virtual canvas. This is not needed for jpg output, but would be for PNG or TIFF.

When we ask for platform, we mean Windows, Mac or Linux. Syntax may vary for Windows vs the others.

-write is not needed in your commands. Typically one adds +delete after mpr:image

Post Reply