Page 1 of 1
filter results completely different in IM 6.9 and IM 7
Posted: 2016-10-19T07:25:18-07:00
by takosuke
Hi!I'm trying to make use of the instagram filters that have been around forever
(here's a link to a python implementation, but they are all the same underlying commands) for a little windows app.
Unfortunately, the commands that use the colortone function work fine in IM up until 6.9, then go crazy in current versions
here's the conflicting commands:
magick.exe convert infile.jpg ( -clone 0 -fill #222b6d -colorize 100% ) ( -clone 0 -colorspace gray -negate ) -compose blend -define compose:args=50,50 -composite nash01.jpg
magick.exe convert nash01.jpg ( -clone 0 -fill #f7daae -colorize 100% ) ( -clone 0 -colorspace gray ) -compose blend -define compose:args=120,-20 -composite nash02.jpg
(I've omitted the final color correction and framing of the image because that doesn't act funny)
I'm using Imagemagick 7.0.3-4 on windows (tried q8 and q16 as well as both 32 and 64 bits to see if it made a difference...). They work fine on 6.9.6-2
I looked over the changes to version 7 and the only thing I gleamed out of it was that the -negate option now needs to have -channel RGB specified beforehand to not affect the alpha as well, but doing ( -clone 0 -colorspace gray -channel RGB -negate ) doesn't change anything
I appreciate any hints!I'd love to be able to make a script that was compatible with both versions, but for now I'm happy to get it working on IM 7...
Here's the images I'm getting:
original image:
first colortone in IM 6.9:
second colortone in IM 6.9
first colortone in IM 7:
second colortone in IM 7:
Re: filter results completely different in IM 6.9 and IM 7
Posted: 2016-10-19T07:50:20-07:00
by snibgo
With v7.0.2-5, your commands seem to work fine if you use "magick" instead of "magick convert".
Re: filter results completely different in IM 6.9 and IM 7
Posted: 2016-10-20T02:16:24-07:00
by takosuke
uh???
Yes they do but...why is that?what's the difference between using magick and magick convert?And more importantly, is this behaviour going to keep changing in successive versions?I'm very confused about all this executable name changing that seems to be happening.
According to the porting to IM 7 guide:
To reduce the footprint of the command-line utilities, these utilities are symbolic links to the magick utility. You can also invoke them from the magick utility, for example, use magick convert logo: logo.png to invoke the convert utility.
so magick and magick convert should be equivalent, right?
Re: filter results completely different in IM 6.9 and IM 7
Posted: 2016-10-20T05:46:28-07:00
by snibgo
takosuke wrote:so magick and magick convert should be equivalent, right?
Well, no, not exactly.
"magick" alone is the new V7 usual program for ImageMagick.
"magick convert" is (I think) the command to use if you need the rest of the command to be interpreted in the v6 way. For example, v6 and v7 have different expectations for what script files may contain when called with "@".
I suggest: if you use v7, you should generally use "magick". Use "magick convert" only when you know you need it.
Re: filter results completely different in IM 6.9 and IM 7
Posted: 2016-10-20T06:19:15-07:00
by takosuke
I see. Thanks. Is that explained in depth somewhere?I don't see that being mentioned in the "porting to Imagemagick version 7" document, and I'm having new issues with my scripts when i use magick instead of magick convert. I also don't get why the commands i explained above work fine in v6 but give funky results when using magick convert in v7...
Re: filter results completely different in IM 6.9 and IM 7
Posted: 2016-10-20T06:40:28-07:00
by snibgo
My comments and suggestions are my own
personal comments and suggestions, not official in any way.
As far as I know, the
V7 porting guide is the only official word.
Incidentally, I don't know why your commands gave bad results with "magick convert". See my bug report
viewtopic.php?f=3&t=29675&p=139017#p139017 , and the update I have just made. I suspect you are hitting this bug.
Re: filter results completely different in IM 6.9 and IM 7
Posted: 2016-10-20T09:43:34-07:00
by takosuke
ha, ok, thanks for all the help!I'm in a crossroad between a bug and command syntax change...
I figured out how to make mostly everything work except for 2 things
the most troubling one is that i don't know how to translate this command
magick convert ( infile.jpg -auto-gamma -modulate 120,50,100 ) ( -size 557x800 -fill rgba(255,153,0,0.5) -draw "rectangle 0,0 557,800" ) -compose multiply kelvin.jpg
if i chain them with -clones like this
magick infile.jpg ( -clone 0 -auto-gamma -modulate 120,50,100 ) ( -clone 0 -size 557x800 -fill rgba(255,153,0,0.5) -draw "rectangle 0,0 557,800" ) -compose multiply kelvin.jpg
i get a bunch of intermediate files so called kelvin1.jpg kelvin2.jpg etc and the final one has the desired result, but the intermediate files and the name change break my scripts...i guess im just not understanding how composing works but I can't get my head around it
The other thing is the -contrast option which has now been replaced by the -level option. It still works but I'd rather not have the error, so I tried to emulate the exact -level settings that the -contrast option produces but without success (its also not on the porting to v7 document). I figured something that's close enough but i'm still puzzled by it!
Re: filter results completely different in IM 6.9 and IM 7
Posted: 2016-10-20T09:55:14-07:00
by snibgo
magick convert ( infile.jpg -auto-gamma -modulate 120,50,100 ) ( -size 557x800 -fill rgba(255,153,0,0.5) -draw "rectangle 0,0 557,800" ) -compose multiply kelvin.jpg
The stuff in the second parenthesis is bad.
( -size 557x800 -fill rgba(255,153,0,0.5) -draw "rectangle 0,0 557,800" )
"-size" does nothing because you are not creating an image. "-fill" is a setting for "-draw", but what are you drawing on?
Logically, the command makes no sense. Unfortunately, IM v6 would do something with illogical commands, but it was difficult for us humans to predict what that was.
You set "-compose Multiply", but nothing uses that setting. I guess you forgot to add the "-composite" operator.
Re: filter results completely different in IM 6.9 and IM 7
Posted: 2016-10-20T10:28:34-07:00
by fmw42
Why not use -brightness-contrast?
Re: filter results completely different in IM 6.9 and IM 7
Posted: 2016-10-24T04:08:21-07:00
by takosuke
thanks, Im still getting around how the IM pipeline works and was using those commands blindly copied from somewhere else. The stuff that you point out as illogical made no sense to me either but it worked when i copied them into IM 6 so I assumed it was me failing to understand something
Also thanks for pointing out -brightness-contrast. I will try this stuff out and make a fork of the python instagram filters repo with the updated commands for everyone's benefit...