scaling down an image gives red and blue shadows?

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.
espressocannon
Posts: 8
Joined: 2017-11-16T10:05:24-07:00
Authentication code: 1152

scaling down an image gives red and blue shadows?

Post by espressocannon »

I am trying to scale down some of my images, but they end up with an ugly red and blue shadow after re-sampling (changing the ratio of pixel number)

https://imgur.com/a/k1SU4

example above

(edited for clarity)
Last edited by espressocannon on 2017-11-16T10:42:38-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: scaling down an image gives red and blue shadows?

Post by fmw42 »

Please always post your IM version and platform when asking questions. Also your exact command line and both the input and output images. There is no example where you have "example here"


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://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
espressocannon
Posts: 8
Joined: 2017-11-16T10:05:24-07:00
Authentication code: 1152

Re: scaling down an image gives red and blue shadows?

Post by espressocannon »

Hi, thanks for the reply.

The version I am using is whatever is latest from apt-get on ubuntu server. I ran a apt-get update right before downloading, and this was yesterday, so unless something has changed since yesterday, I have the latest version from APT

What I am doing is two seperate things.

1. I am converting from RAW to JPG and resizing (not the example image above) using the following command:

convert nef:/media/kandeNAS/2013/Katarina 60s Glam/_DSC9864.NEF -resize 75% /media/kandeNAS/2013/Katarina 60s Glam/optim/_DSC9864.jpg

the "nef" and path are generated by the script based on file type, etc etc.

2. Resizing JPGS (as in the above linked image - here for your convenience: https://imgur.com/a/k1SU4 ) using the following command.

convert /media/kandeNAS/2012/2012-March/IMG_5558.JPG -resize 75% /media/kandeNAS/2012/2012-March/optim/IMG_5558.jpg

This produces the above example. where the shadows have a blue and red haze in them, in underexposed images, the effect is more pronounced.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: scaling down an image gives red and blue shadows?

Post by fmw42 »

Sorry, but I need to know the exact version of ImageMagick and the date associated with it. Use

Code: Select all

convert -version
I also need to be able to download your input and output image. I do not know how to get those from imgur. I only see one image. Also it appears that I have to login and I have no access.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: scaling down an image gives red and blue shadows?

Post by fmw42 »

Which of the two commands are giving you trouble? Or are you running both commands on the same image taking the output from the first command and using it for the input of the second command.
espressocannon
Posts: 8
Joined: 2017-11-16T10:05:24-07:00
Authentication code: 1152

Re: scaling down an image gives red and blue shadows?

Post by espressocannon »

sorry about the confusion. If the image is JPG I run the JPG command on them - and if the image is RAW I run the RAW command on them. never both commands.

=======================================================================

here is the exact command I ran on this RAW image:

convert cr2:/media/kandeNAS/2012/2012-12-24/_MG_9449.CR2 -resize 75% /media/kandeNAS/2012/2012-12-24/optim/_MG_9449.jpg

Raw image and JPG output can be downloaded from this public dropbox folder (just hit download, you do not need to log in)

https://www.dropbox.com/sh/u9lljwajto70 ... EB5la?dl=0

=======================================================================

output of "convert -version"

Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-07-31 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib

PS. CORRECTION: This does not seem to occur on JPG > JPG - Only RAW (cr2) > JPG
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: scaling down an image gives red and blue shadows?

Post by fmw42 »

I downloaded the example.nef from https://www.online-convert.com/file-format/nef and processing it on IM 6.9.9.23 Q16 Mac OSX with the following command:

Code: Select all

convert nef:example.nef -resize 75% example.jpg
The result was a bit darker than the new file, but the colors were good.

So I reprocessed as

Code: Select all

convert nef:example.nef -resize 75% -auto-level -gamma 1.5 example4.jpg
and get a better match of brightness and contrast.

I see no signs of color shifts
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: scaling down an image gives red and blue shadows?

Post by fmw42 »

I ran your cr2 image with your command on my IM 6.9.9.23 Q16 Mac OSX and got no red speckle distortion and you show in your output.

Code: Select all

convert cr2:"_MG_9449.CR2" -resize 75% test1.jpg

Also what version of dcraw and libjpeg?

I am using

dcraw @9.27.0_2
jpeg @9b_0

Perhaps you need to upgrade one or both.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: scaling down an image gives red and blue shadows?

Post by fmw42 »

6.8.9.9 is over 100 versions old. You might consider upgrading IM also. However, it looks to be patched at July 2017. So it may be OK. Though you could check to see if there is a more current patch. My guess is it is your version of dcraw.
espressocannon
Posts: 8
Joined: 2017-11-16T10:05:24-07:00
Authentication code: 1152

Re: scaling down an image gives red and blue shadows?

Post by espressocannon »

fmw42 wrote: 2017-11-16T11:18:41-07:00 I ran your cr2 image with your command on my IM 6.9.9.23 Q16 Mac OSX and got no red speckle distortion and you show in your output.

Code: Select all

convert cr2:"_MG_9449.CR2" -resize 75% test1.jpg

Also what version of dcraw and libjpeg?

I am using

dcraw @9.27.0_2
jpeg @9b_0

Perhaps you need to upgrade one or both.
hello. I posted my results of convert -version above. Here it is again:

Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-07-31 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib

I do not know how to get the versions of dcraw or libjpeg

dcraw -version gives me "The program 'dcraw' is currently not installed."
libjpeg -version gives me "command not found"
espressocannon
Posts: 8
Joined: 2017-11-16T10:05:24-07:00
Authentication code: 1152

Re: scaling down an image gives red and blue shadows?

Post by espressocannon »

fmw42 wrote: 2017-11-16T11:20:07-07:00 6.8.9.9 is over 100 versions old. You might consider upgrading IM also. However, it looks to be patched at July 2017. So it may be OK. Though you could check to see if there is a more current patch. My guess is it is your version of dcraw.
shouldn't the version from APT be the most current version?

Why would there be a version that is 100 versions old on APT?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: scaling down an image gives red and blue shadows?

Post by fmw42 »

Linux systems patch old version. Your version by number is old, but has been patched most recently in July 2017. So is likely current. But since I do not know what the latest patch is, I cannot say. Furthermore I dislike the process of patching, since patches can be bad or missed. Thus it is hard to really tell what version is being used. If you believe the patch date then it goes back to IM between 6.9.9.0 and 6.9.9.5, but current IM is as 6.9.9.23.

try

Code: Select all

convet -list format
JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (90)
JPG* JPEG rw- Joint Photographic Experts Group JFIF format (90)

Also

Code: Select all

dcraw
Raw photo decoder "dcraw" v9.27
espressocannon
Posts: 8
Joined: 2017-11-16T10:05:24-07:00
Authentication code: 1152

Re: scaling down an image gives red and blue shadows?

Post by espressocannon »

fmw42 wrote: 2017-11-16T11:36:22-07:00 Linux systems patch old version. Your version by number is old, but has been patched most recently in July 2017. So is likely current. But since I do not know what the latest patch is, I cannot say. Furthermore I dislike the process of patching, since patches can be bad or missed. Thus it is hard to really tell what version is being used. If you believe the patch date then it goes back to IM between 6.9.9.0 and 6.9.9.5, but current IM is as 6.9.9.23.

try

Code: Select all

convet -list format
JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (90)
JPG* JPEG rw- Joint Photographic Experts Group JFIF format (90)

Also

Code: Select all

dcraw
Raw photo decoder "dcraw" v9.27
my JPG results from convert -list format does not look the same: I get

JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (80)
JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (80)

Here are some more attempts to make things work:::

"dcraw -T nephew.CR2" provides the correct result. (outputs a TIFF file - not ideal)

trying to convert TIFF to JPG with imagemagick using: "convert nephew.tiff nephew-fromtiff.jpg" produces the correct result but throws a LOT of errors (not comfortable with errors when archiving thousands of files)

on UBUNTU - "convert cr2:nephew.CR2 nephew-ubuntu.jpg" provides the version with the glitched-out shadows (as above).

on WINDOWS - "magick nephew.CR2 nephew-windows.jpg" - Produces correct result (not ideal as I don't want my work system to be doing this - it's going to take about two months of full CPU to get thru my library)

Here is a dropbox folder with all above results and the source. as well as a text file with all the errors produced from "convert nephew.tiff to nephew-fromtiff.jpg"
https://www.dropbox.com/sh/4pk7ouwghkzf ... SqFza?dl=0
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: scaling down an image gives red and blue shadows?

Post by fmw42 »

All your messages are warnings. You can suppress them by adding -quiet to your command line after convert.

You might try upgrading JPEG. That version is old.

Using CR2 directly should produce a JPG if you use the proper arguments.

Did you check the dcraw version as I showed above?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: scaling down an image gives red and blue shadows?

Post by fmw42 »

P.S. When using draw directly it probably know more about brightness corrections from its meta data that IM does not know. So that is likely why my IM conversion is darker than the cr2 original. Nevertheless you should not be getting any red speckles.

I am not an expert on raw formats such as NEF or CR2. So perhaps one of the photographer experts who use those formats can comment further on the differences in brightness between IM conversion and direct conversion.
Post Reply