I obtain rare effect when I scale a image in imagemagick

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
diegomage
Posts: 168
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

I obtain rare effect when I scale a image in imagemagick

Post by diegomage » 2017-08-15T16:35:55-07:00

Image

I scale this image with this command

convert img -scale 270% imgr


and I obtain this effect in the border

Image


How I could convert i image without lose or change the colors

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

Re: I obtain rare effect when I scale a image in imagemagick

Post by fmw42 » 2017-08-15T16:38:24-07:00

try

Code: Select all

convert PaeLa.png -sample 270% result.png

diegomage
Posts: 168
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: I obtain rare effect when I scale a image in imagemagick

Post by diegomage » 2017-08-15T16:41:34-07:00

this works very thankyou

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

Re: I obtain rare effect when I scale a image in imagemagick

Post by fmw42 » 2017-08-15T16:42:20-07:00

What is your IM version and platform? I do not get that effect even using your command:

Code: Select all

convert PaeLa.png -scale 270% result.png
Are you sure that is the command you actually used (not -resize nor -resample)

How did you view the result in zoomed view? What viewer? Perhaps your viewer is doing bilinear enlarging rather than pixel replication?

diegomage
Posts: 168
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: I obtain rare effect when I scale a image in imagemagick

Post by diegomage » 2017-08-15T16:47:04-07:00

this is my version
Version: ImageMagick 7.0.6-0 Q16 x86_64 2017-07-12 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC

diegomage
Posts: 168
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: I obtain rare effect when I scale a image in imagemagick

Post by diegomage » 2017-08-15T16:48:26-07:00

my command is scale my viewer is kolour paint (but i use a convert command for check the color and the color changed in the border too)

diegomage
Posts: 168
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: I obtain rare effect when I scale a image in imagemagick

Post by diegomage » 2017-08-15T16:49:57-07:00

this is my result image using this command

Code: Select all

convert img -scale 270% imgr
convert img -scale 270% imgr
Image

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

Re: I obtain rare effect when I scale a image in imagemagick

Post by fmw42 » 2017-08-15T18:09:35-07:00

Using IM 6.9.6.7 Q16 and IM 7.0.6.7 Q16 HDRI, I get your same result when using -scale when zooming a factor of 8. But using -sample works fine for me in both versions when zooming a factor of 8. Try -sample.

See
http://www.imagemagick.org/script/comma ... php#sample
http://www.imagemagick.org/script/comma ... .php#scale

If you were using an integer enlargement (200%, 300%, 400% etc), then both should produce the same results with no new colors.

I am not sure about non-integer enlargement values, but it was my understanding that both -scale and -sample enlarged with the same method. So if this is correct, then perhaps there is a bug. However, if I am wrong and -scale enlarges by non-integer values by blending, then this result is correct.

Bonzo
Posts: 2850
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: I obtain rare effect when I scale a image in imagemagick

Post by Bonzo » 2017-08-16T02:18:54-07:00

For your information V7 uses magick rather than convert. If you installed legacy programs convert will work but you will then be using a V6 version.

User avatar
magick
Site Admin
Posts: 10690
Joined: 2003-05-31T11:32:55-07:00

Re: I obtain rare effect when I scale a image in imagemagick

Post by magick » 2017-08-16T04:10:25-07:00

If you scale by whole integers 200, 300, and 400%, for example, no new colors are introduced. The scanlines are duplicated. However if you enlarge by a non-integer factor, new colors are introduced. Scanlines are blended. 270% is a factor of 2.7. So in the example you provide, new colors are expected.

Post Reply