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: 205
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 »

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: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post by fmw42 »

try

Code: Select all

convert PaeLa.png -sample 270% result.png
diegomage
Posts: 205
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 »

this works very thankyou
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post by fmw42 »

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: 205
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 »

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: 205
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 »

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: 205
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 »

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: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post by fmw42 »

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: 2971
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 »

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: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick »

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