Library producing 12MB MIFF images

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
images
Posts: 9
Joined: 2019-08-26T15:26:11-07:00
Authentication code: 1152

Library producing 12MB MIFF images

Post by images »

Hi

I have an application that reads a stream of bytes from a VGA port and sends it to MAgickWand function MagickConstituteImage() to create an image from raw uint8_t data. Then I am calling MagickSetImageCompressionQuality() to reduce the quality of image followed by MagickWriteImage() used to create a final image in JPEG format.

MagickConstituteImage(wand, 1920, 1080, BGRP, CharPixel, buffer)
MagickSetImageCompressionQuality(wand, 45)
MagickWriteImage(wand, "file.jpeg")
ClearMagickWand(wand)

At the end here I am getting an image.

Now, I tried with two IM libs built differently on my Ubuntu 16.04.6 LTS, x86-64 bit mAchine
1) the rpms from ImageMagick-devel-7.0.8-63.x86_64.rpm
ImageMagick-libs-7.0.8-63.x86_64.rpm. I converted these rpms to .deb files and then installed on my machine. The above application produced a MIFF image of 12MB each time and the image does not open throwing an error.

2)I also created rpms with make rpm command from 7.0.8.63 and I am facing the same issue as stated in 1 (where I am getting the image in MIFF format and the image won't open)

3) I checked out a code from ImageMagick github, version 7.0.8.63. I called ./configure and make and used the libMagickCore-7.Q16HDRI.so.6 and libMagickWand-7.Q16HDRI.so.6 created from there to run my application. I am getting the JPEG version and my image size is 192KB.

My questions:
1) Is anything obvious that I am missing while directly loading the libs from rpms, since I face the issue in both 7.0.8.63 and 7.0.8.64. Are there additional libs required to be loaded in tandem with imagemagick-devel and imagemagick-libs or is there any other version that does not have this issue?

2)Is MIFF an intermediate state of images to be converted using coders?

3)What is it that I could be missing when using the libs from rpms (steps 1 and 2) as compared to making the libs from source
code(step 3) and using it. The same application as above is producing MIFF in the first two cases and a JPEG in the 3rd case.
Last edited by images on 2019-09-11T09:03:08-07:00, edited 2 times in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Library producing 12MB MIFF images

Post by snibgo »

Can your build of IM write JPEG images? I suspect not, possibly because you haven't included a JPEG library.
snibgo's IM pages: im.snibgo.com
images
Posts: 9
Joined: 2019-08-26T15:26:11-07:00
Authentication code: 1152

Re: Library producing 12MB MIFF images

Post by images »

I have these two jpegs libs on my system. Are you talking about these or some other dependencies IM specific I need to install?
libjpeg.so.8 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libjpeg.so.8
libjpeg.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libjpeg.so
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Library producing 12MB MIFF images

Post by fmw42 »

What do you get from

Code: Select all

magick -version

or 

magick -list configure
does it list jpg or jpeg in the line for Delegates. If not, then you either have not installed libjpg where ImageMagick can find it or the llibjpg was installed faulty.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Library producing 12MB MIFF images

Post by snibgo »

As Fred says.

Sorry, I don't know about specific libraries on specific platforms. Your config.log will tell you what libraries have been included within an IM build.
snibgo's IM pages: im.snibgo.com
images
Posts: 9
Joined: 2019-08-26T15:26:11-07:00
Authentication code: 1152

Re: Library producing 12MB MIFF images

Post by images »

magick -version
Version: ImageMagick 7.0.8-63 Q16 x86_64 2019-08-29 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(3.1)
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib jng jp2 jpeg lcms ltdl lzma openexr pangocairo png ps rsvg tiff webp wmf x xml zlib

From config.log, I see I have installed ljpeg
MAGICK_LIBS=' -ljbig -llcms2 -ltiff -lfreetype -ljpeg -llqr-1 -lglib-2.0 -lpng12 -ldjvulibre -lfontconfig -lfreetype -lwmflite -lXext -lXt -lSM -lICE -lX11 -llzma -lbz2 -lIlmImf -lImath -lHalf -lIex -lIexMath -lIlmThread -lpthread -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lcairo -lxml2 -lgvc -lcgraph -lcdt -lz -lm -lgomp'

from both outputs I see that the delegates list jpeg. Sorry I am pretty new to this but is there a way to figure out if the lib is faulty?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Library producing 12MB MIFF images

Post by fmw42 »

OK, you do have jpeg listed. Does this work?

Code: Select all

magick logo: logo.jpg
magick logo.jpg logo.gif
If so, then everything is fine with regard to your jpg delegate and I would suggest you review your code.
images
Posts: 9
Joined: 2019-08-26T15:26:11-07:00
Authentication code: 1152

Re: Library producing 12MB MIFF images

Post by images »

yes the above two works for me. I can see jpg and gif being created
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Library producing 12MB MIFF images

Post by fmw42 »

MIFF can only be viewed using ImageMagick display command. How did you try to open it? It has a header that can be viewed if you open the file in a text editor. The pixel data will be gibberish in the text editor, however.
images
Posts: 9
Joined: 2019-08-26T15:26:11-07:00
Authentication code: 1152

Re: Library producing 12MB MIFF images

Post by images »

I think display should work then with MIFF images but I want to create a JPEG image that occupies less space which I am able to do when I use a library built from the source code. But when I try to use the rpms available on their website as well as try creating a rpm using their source code and use the library then, i face this issue where I am not able to produce a jpeg image. I believe MIFF is some intermediate state which is used by the coders to create any different globally accepted image format. Any clue how to debug this?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Library producing 12MB MIFF images

Post by fmw42 »

add -verbose to your command line or -debug all and post the results here for the ImageMagick developers to see what might be wrong.
Post Reply