Crop an image. Few pixels color changed.

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
HosinaTomoko
Posts: 1
Joined: 2018-10-29T03:14:14-07:00
Authentication code: 1152

Crop an image. Few pixels color changed.

Post by HosinaTomoko »

Hi.
I used convert to crop the margins.
But some pixels have changed color. (That part is one color)

1. use convert.exe on command line
convert [IMAGE] -crop 20x439+760+9 -format "%c" histogram:info:

2. actual result
20: ( 25, 32, 58) #19203A srgb(25,32,58)
8748: ( 25, 32, 60) #19203C srgb(25,32,60)
12: ( 25, 32, 61) #19203D srgb(25,32,61)

* expected result = 8780: ( 25, 32, 60) #19203C srgb(25,32,60)

3. so i checked entire pixel
convert [IMAGE] -crop 20x439+760+9 -format "%c" txt:

4,23: (6425,8224,14906) #19203A srgb(25,32,58)
5,23: (6425,8224,14906) #19203A srgb(25,32,58)
...
2,35: (6425,8224,15677) #19203D srgb(25,32,61)
3,35: (6425,8224,15677) #19203D srgb(25,32,61)
...

---------------------------------------------------

I wonder what causes this result.
And how do i get the results I want?
(need more crop option / image problem / etc...)


Image


ps. I crop the margin using WINDOWS PAINT and the tested it. No problem.
8780: ( 25, 32, 60) #19203C srgb(25,32,60)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Crop an image. Few pixels color changed.

Post by snibgo »

Have you posted the actual file you used in your command? The posted file is a JPEG, which is useful for photographs, but is lossy and areas of flat constant colour do not remain constant.

JPEG should not be used if you expect certain colours to be present.
snibgo's IM pages: im.snibgo.com
Post Reply