0

I'm trying to crop a small part of an image. I used ImageMagick command for this as below:

convert image.jpg -crop 6x6+16+16 +repage image_crop.jpg

However, when I try to compare pixel values in both the images for the same block, it doesn't match. For example, pixel value at position (16,16) in image.jpg should match with pixel value at (0,0) in image_crop.jpg. Any ideas on how to crop an image so that pixel values are not modified?

Note: I'm comparing the pixel values by dumping the image data into a text file as below:

convert image.jpg image.txt
gioele
  • 9,748
  • 5
  • 55
  • 80
pree
  • 2,297
  • 6
  • 37
  • 55
  • 1
    Do you get the same result when writing to a lossless format like PNG? – nwellnhof Mar 25 '13 at 23:20
  • @nwellnhof Yes, it is same. It means it was changing the pixel values due to lossy nature of JPEG whereas it retains values in PNG. – pree Mar 25 '13 at 23:47

0 Answers0