combine filters: bicubic (shadows) & lagrange (highlights)
combine filters: bicubic (shadows) & lagrange (highlights)
Hi.
Can I combine (2) different filters for downsizing photos ?
I like bicubic for the shadow areas of a photo
I like Lagrange for the highlight areas of a photo
I want to do this in 1 operation if possible
Thank you.
Can I combine (2) different filters for downsizing photos ?
I like bicubic for the shadow areas of a photo
I like Lagrange for the highlight areas of a photo
I want to do this in 1 operation if possible
Thank you.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: combine filters: bicubic (shadows) & lagrange (highlight
One way of doing this would be to do both resizes, then merge them together with a mask, so the dark pixels come from the bicubic resize and the light pixel come from the Lagrange resize. Intermediate shades would be a blend of the two.
The command would be something like this (Windows syntax):
The third clone forms the mask. Where it is black, we get the cubic pixels, etc. You might want to blur the third clone to graduate the transition, so the pixels from dark areas come from cubic. You might also use "-sigmoidal-contrast" or even "-threshold" on the mask.
It might also be better to explicitly convert the third clone to grayscale.
The command would be something like this (Windows syntax):
Code: Select all
convert ^
input.tiff ^
( -clone 0 filter Cubic resize 25%% ) ^
( -clone 0 filter Lagrange resize 25%% ) ^
( -clone 2 ) ^
+delete 0 ^
-composite ^
output.tiff
It might also be better to explicitly convert the third clone to grayscale.
snibgo's IM pages: im.snibgo.com
Re: combine filters: bicubic (shadows) & lagrange (highlight
Thanks snibgo.
I can combine 2 images more accurately in Photoshop, I am searching for a single operation in imagemagick.
For example, Photoshop uses 0-255 levels so, if I want
Levels: 0-128 IM filter bicubic
Levels: 128-255 Lagrange
...then combine the 2, is that possible in ImageMagick ?
I can combine 2 images more accurately in Photoshop, I am searching for a single operation in imagemagick.
For example, Photoshop uses 0-255 levels so, if I want
Levels: 0-128 IM filter bicubic
Levels: 128-255 Lagrange
...then combine the 2, is that possible in ImageMagick ?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: combine filters: bicubic (shadows) & lagrange (highlight
Sure. Just threshold the mask at 50%:
(This is Windows syntax. Adjust as required for Unix or whatever.)
Code: Select all
convert ^
input.tiff ^
( -clone 0 filter Cubic resize 25%% ) ^
( -clone 0 filter Lagrange resize 25%% ) ^
( -clone 2 -threshold 50%% ) ^
+delete 0 ^
-composite ^
output.tiff
snibgo's IM pages: im.snibgo.com
Re: combine filters: bicubic (shadows) & lagrange (highlight
Like this ?
$ convert input.tiff \( -clone 0 filter Cubic -resize 1024 \) \( -clone 0 filter Lagrange -resize 1024 \) \( -clone 2 -threshold 50%% \) +delete 0 -composite output.tiff
I think this will use the Cubic for values 0-128, and Lagrange for 129-255, then composite them together ?
I forgot, is it possible to slightly blur the mask used for the blend ?
Thank you again.
$ convert input.tiff \( -clone 0 filter Cubic -resize 1024 \) \( -clone 0 filter Lagrange -resize 1024 \) \( -clone 2 -threshold 50%% \) +delete 0 -composite output.tiff
I think this will use the Cubic for values 0-128, and Lagrange for 129-255, then composite them together ?
I forgot, is it possible to slightly blur the mask used for the blend ?
Thank you again.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: combine filters: bicubic (shadows) & lagrange (highlight
convert input.tiff \( -clone 0 filter Cubic -resize 1024 \) \( -clone 0 filter Lagrange -resize 1024 \) \( -clone 2 -threshold 50%% \) +delete 0 -composite output.tiff
You have mixed Windows and Unix syntax and are missing the minus sign before filter (-filter). If on windows, remove all the \ . If on Unix make %% into %. If you want to blur the mask (and unix), then use
Code: Select all
convert input.tiff \( -clone 0 -filter Cubic -resize 1024 \) \( -clone 0 -filter Lagrange -resize 1024 \) \( -clone 2 -threshold 50% -blur 0x1 \) +delete 0 -composite output.tiff
Code: Select all
convert input.tiff ( -clone 0 -filter Cubic -resize 1024 ) ( -clone 0 -filter Lagrange -resize 1024 ) ( -clone 2 -threshold 50% -blur 0x1 ) +delete 0 -composite output.tiff
see
http://www.imagemagick.org/Usage/windows/
http://www.imagemagick.org/Usage/basics/#parenthesis
Re: combine filters: bicubic (shadows) & lagrange (highlight
fmw42,
System: Imagemagick 6.7.7.10-7 , Debian Testing
I tried your code...
Did I do that right ? I got some bizarre composite and it did not resize;
http://i836.photobucket.com/albums/zz29 ... 7f35f7.png
System: Imagemagick 6.7.7.10-7 , Debian Testing
I tried your code...
Code: Select all
convert original.tif \( -clone 0 -filter Cubic -resize 1024 \) \( -clone 0 -filter LanczosSharp -resize 1024 \) \( -clone 2 -threshold 50% -blur 0x1 \) +delete 0 -composite output.tiff
http://i836.photobucket.com/albums/zz29 ... 7f35f7.png
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: combine filters: bicubic (shadows) & lagrange (highlight
My oversight. It should be -delete 0 not +delete 0. Try the following with a few minor changes to play it safe
convert original.tif \( -clone 0 -filter Cubic -resize 1024x1024 \) \( -clone 0 -filter LanczosSharp -resize 1024x1024 \) \( -clone 2 -threshold 50% -blur 0x1 \) -delete 0 -compose over -composite output.tiff
convert original.tif \( -clone 0 -filter Cubic -resize 1024x1024 \) \( -clone 0 -filter LanczosSharp -resize 1024x1024 \) \( -clone 2 -threshold 50% -blur 0x1 \) -delete 0 -compose over -composite output.tiff
Re: combine filters: bicubic (shadows) & lagrange (highlight
Fantastic !
Just what the doctor ordered... sucess, thanks so much.
One small problem, can you think of a reason Photoshop opens the image zoomed in all the way ?
It opens in Windows/Linux perfectly with Gimp Linux/Windows, but Photoshop CC 64 & Bridge
views the IM images so I can't see the whole image.
Thanks again.
Just what the doctor ordered... sucess, thanks so much.
One small problem, can you think of a reason Photoshop opens the image zoomed in all the way ?
It opens in Windows/Linux perfectly with Gimp Linux/Windows, but Photoshop CC 64 & Bridge
views the IM images so I can't see the whole image.
Thanks again.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: combine filters: bicubic (shadows) & lagrange (highlight
I cannot see there would be anything about the image that cause PS to do that. Perhaps there is some setting in PS that tells it a default zoom to use.
Does the input image zoom when opened in PS? Are the image formats the same (both tiff?). Perhaps it has to do with some tiff setting? Does it happen when both input and output images are PNG rather than TIFF?
Does the input image zoom when opened in PS? Are the image formats the same (both tiff?). Perhaps it has to do with some tiff setting? Does it happen when both input and output images are PNG rather than TIFF?
Re: combine filters: bicubic (shadows) & lagrange (highlight
I opened the output.tif with Xnview, saved as uncompressed tif, then PS will open without problem... wierd.
png works as expected without error, must be some .tif saved related IM issue.
Should ignore these error messages ?
convert.im6: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/768.
convert.im6: Incompatible type for "FileSource"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/768.
convert.im6: Incompatible type for "SceneType"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/768.
convert.im6: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/768.
Thanks.
png works as expected without error, must be some .tif saved related IM issue.
Should ignore these error messages ?
convert.im6: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/768.
convert.im6: Incompatible type for "FileSource"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/768.
convert.im6: Incompatible type for "SceneType"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/768.
convert.im6: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/768.
Thanks.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: combine filters: bicubic (shadows) & lagrange (highlight
It is not IM, but likely some tiff tag that IM does not understand.
All these are warnings that IM does not recognize one or more Tiff tags. Tiff is a very flexible format with regard to storing lots of specialized meta data. They all can be ignored.
I suspect one of the specialized tags stored in the tif file is telling it to be displayed in a zoomed mode. That tag will be ignored by many viewers. But since TIFF was originally a PS format, they probably recognize this tag and PS sees it an displays it accordingly.
All these are warnings that IM does not recognize one or more Tiff tags. Tiff is a very flexible format with regard to storing lots of specialized meta data. They all can be ignored.
I suspect one of the specialized tags stored in the tif file is telling it to be displayed in a zoomed mode. That tag will be ignored by many viewers. But since TIFF was originally a PS format, they probably recognize this tag and PS sees it an displays it accordingly.
Re: combine filters: bicubic (shadows) & lagrange (highlight
I guess I could save to PNG, then pipe to IM tiff... hmmmm, maybe that would slap it into conformity.
I forgot, if I want to apply one filter to the shadow area only ( 0-64 ), would the code change like this;
Thank you all so much, have a Happy, Healthy New Year.
I forgot, if I want to apply one filter to the shadow area only ( 0-64 ), would the code change like this;
Code: Select all
\( -clone 2 -threshold 25% \)
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: combine filters: bicubic (shadows) & lagrange (highlight
Yes, 25% would do the job.
Sorry for the syntax errors in my first post. Thanks to fmw for correcting them.
Sorry for the syntax errors in my first post. Thanks to fmw for correcting them.
snibgo's IM pages: im.snibgo.com
Re: combine filters: bicubic (shadows) & lagrange (highlight
Thanks to all.
[SOLVED]
[SOLVED]