-liquid-rescale abends

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
rmagick
Posts: 245
Joined: 2006-03-16T17:30:48-07:00
Location: Durham, NC, USA

-liquid-rescale abends

Post by rmagick »

Is it just me, or is the -liquid-rescale delegate still a bit green? I'm running 6.3.8-2 and liblqr-1-0.1.0. Both of these tests abend in liblqr

convert -size 20x20 xc:white -liquid-rescale 500x500 test.miff

abends with a segfault. gdb says
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1217444176 (LWP 5060)]
0xb79f289d in lqr_carver_build_vpath () from /usr/lib/liblqr-1.so.0
(gdb) whe
#0 0xb79f289d in lqr_carver_build_vpath () from /usr/lib/liblqr-1.so.0
#1 0xb79f4428 in lqr_carver_build_vsmap () from /usr/lib/liblqr-1.so.0
#2 0xb79f4621 in lqr_carver_build_maps () from /usr/lib/liblqr-1.so.0
#3 0xb79f4796 in lqr_carver_resize_width () from /usr/lib/liblqr-1.so.0
#4 0xb79f4882 in lqr_carver_resize () from /usr/lib/liblqr-1.so.0
#5 0xb7e15533 in LiquidRescaleImage (image=0x805b038, columns=500, rows=500, delta_x=1, rigidity=0, exception=0x804a030) at magick/resize.c:1493
#6 0xb7c95160 in MogrifyImage (image_info=0x804a3f0, argc=5, argv=0x804a05c, image=0xbfb22150, exception=0x804a030) at wand/mogrify.c:1522
#7 0xb7cb8c88 in MogrifyImages (image_info=0x804a3f0, argc=5, argv=0x804a05c, images=0xbfb221c8, exception=0x804a030) at wand/mogrify.c:7065
#8 0xb7c414df in ConvertImageCommand (image_info=0x804a3f0, argc=7, argv=0x804a058, metadata=0x0, exception=0x804a030) at wand/convert.c:2630
#9 0x08048b3d in main (argc=7, argv=0xbfb22444) at utilities/convert.c:122
convert Flower_Hat.jpg -liquid-rescale 500x500 test.miff

abends with
*** glibc detected *** convert: double free or corruption (out): 0xb764a008 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7a69d65]
/lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7a6d800]
/usr/lib/libglib-2.0.so.0(g_free+0x31)[0xb7952961]
/usr/lib/liblqr-1.so.0(lqr_carver_inflate+0x26e)[0xb79dc77e]
/usr/lib/liblqr-1.so.0(lqr_carver_build_vsmap+0x15c)[0xb79dd4fc]
/usr/lib/liblqr-1.so.0(lqr_carver_build_maps+0x71)[0xb79dd621]
/usr/lib/liblqr-1.so.0(lqr_carver_resize_width+0x66)[0xb79dd796]
/usr/lib/liblqr-1.so.0(lqr_carver_resize+0x52)[0xb79dd882]
/home/software/ImageMagick-6.3.8/lib/libMagick.so.10(LiquidRescaleImage+0x3d9)[0xb7dfe533]
/home/software/ImageMagick-6.3.8/lib/libWand.so.10(MogrifyImage+0x42d2)[0xb7c7e160]
/home/software/ImageMagick-6.3.8/lib/libWand.so.10(MogrifyImages+0x282)[0xb7ca1c88]
/home/software/ImageMagick-6.3.8/lib/libWand.so.10(ConvertImageCommand+0x186dd)[0xb7c2a4df]
convert[0x8048b3d]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb7a16050]
convert[0x8048941]
where Flower_Hat.jpg is this image Image
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: -liquid-rescale abends

Post by magick »

Seems that LQR requires a rescale less than twice the original width/height. We'll add a patch to ImageMagick to account for this limitation.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -liquid-rescale abends

Post by fmw42 »

I did a number of tests of liquid-rescale on Mac OS X Tiger, IM 6.3.8-2beta at

http://www.fmwconcepts.com/misc_tests/l ... index.html

and did not have problems. But I did not try to expand by much, certainly not a factor of 2.

But I tried your image and example and found the following:

convert Flower_Hat.jpg -liquid-rescale 500x500 test.png ---- worked fine

convert Flower_Hat.jpg -liquid-rescale 500x500! test.png ---- produced an unrecognizable image.

convert Flower_Hat.jpg -liquid-rescale 600x600 flowerhat5.png --- Segmentation fault
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Re: -liquid-rescale abends

Post by dognose »

Wow, those are really nice examples. Better quality than I was hoping for.

Now if I could only get this version installed....
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: -liquid-rescale abends

Post by Bonzo »

Interesting images and I have not seen -liquid-rescale before.
I must say this image made me laugh http://www.fmwconcepts.com/misc_tests/l ... _75pct.jpg
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -liquid-rescale abends

Post by fmw42 »

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: -liquid-rescale abends

Post by anthony »

Bonzo wrote:Interesting images and I have not seen -liquid-rescale before.
I must say this image made me laugh http://www.fmwconcepts.com/misc_tests/l ... _75pct.jpg
Except user based filter image controls are not as yet available. As such the above 'funny' is not as yet posible in IM's initial version of this operation. I hope to see some expert level access to some of internals to allow better control. for this and other methods :-)

Remember liquid resize can produce some strong aliasing effects and 'seam' cut types of artifacts in the resulting image.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: -liquid-rescale abends

Post by Bonzo »

I have just tried it in my windows XAMPP setup and get an error:
convert: delegate library support not built-in `2007_1226christmas0004.JPG' (LQR).

I will wait a while as hopefuly the next release will have the lqr built in ?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: -liquid-rescale abends

Post by anthony »

The lqr library is a delegate library, external to IM.
You will need it installed to make use of -liquid-resize

NOTE: i would class -liquid-resize as still in an experimental stage. Its interface may change in the future.

For example it may get more options (energy function to use, output controls, etc), or take two images (or more) as apart of its special resize capabilities.

For example if you have two images the second may be the energy mask or a simpler 'remove/preserve' type mask.

The lqr library has quite a number of options that are most useful, and not just in liquid resizing either.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: -liquid-rescale abends

Post by anthony »

After doing some experiments myself with -liquid-rescale in IM examples...
http://imagemagick.org/Usage/resize/#liquid-rescale
(should appear in a few hours).

I discovered that if I created my 'logo' animation without 'trimming' the animation first, -liquid-rescale will first remove all the seams on the left side of the image first, THEN all the ones of the right side...

Image

The script that produced the above is very similar to the one in IM Examples, Liquide Resize Examples. Just without the initial -trim

I believe there is an option to the LQR library that makes the seam removal less one-sided. i suggest that this option be made the default.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: -liquid-rescale abends

Post by Bonzo »

I would agree with you Anthony about equalising the seams from each side rather than one side first. If it is an option within the delegate file is that one of the options the user could specify ?

I did download the delegate library but have no idea how to link/install or whatever into my copy of ImageMagick which is on a windows XP PC or for that mater on the Linux machine that when I find time I will start looking into.

To little free time and to much to do :(
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: -liquid-rescale abends

Post by anthony »

I found a RPM for the library, then build a ImageMagick SRPM with the configuration option --with-lqr so that it will build a IM RPM package that included the LQR stuff.

If you haven't guessed I try hard to install things in RPM packages, and it makes the cleanup and upgrades just so much easier.

If I didn't have an RPM. thne I would install the whole package into a special sub-directory (--prefix configuration option) so I only need to remove that directory to remove the package later.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
robins

Re: -liquid-rescale abends

Post by robins »

Hi Anthony,

I tried your suggestion to install it into a separate folder but I still cannot get -liquid-resize to function

this is how I installed it:

./configure --prefix /home/xyz/installationpath --with-lqr
./make
./make install

for the IM command I did /home/xyz/installationpath/bin/convert input.jpg --liquid-resize 100x80\! output.jpg

but it told me that -liquid-resize was not available. Beforehand I had installed:

liblqr-1-0 and liblqr-devel


Best regards

Robin

(ps running Opensuse 11.3)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: -liquid-rescale abends

Post by anthony »

First resurrecting a very old thread like this is not a good. You should have started a new one.

However you have it only partially right. See the 'personal installation' notes in
http://www.imagemagick.org/Usage/api/#personal

I do this to generate a special HDRI version of IM, as a separate version to the system installed IM.

Also the -with-lrq used to be present in this, but is no longer needed All that is necessary is for the LQR development libraries to be installed, at the time of the configure for LQR to be included.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply