Results 1 to 9 of 9

Thread: Qt + ImageMagick

  1. #1
    Join Date
    Aug 2006
    Posts
    90
    Thanks
    6
    Thanked 4 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qt + ImageMagick

    EDIT:

    I read a bunch of other peoples posts about the lack of Tiff support in Qt. Has anyone integrated ImageMagick with Qt to display images in a cross platform manner? I am wanting to diplay TIFFs with a QT MDI.

    I am using Qt 4.2
    Last edited by bpetty; 13th April 2007 at 20:08. Reason: read other peoples posts

  2. #2
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt + ImageMagick

    If tiff support is all you need, try TiffIO

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt + ImageMagick

    Afaik recent versions of Qt4 have native support for TIFF. At least it seems so, looking at configure -help.

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt + ImageMagick

    If all you want is tiff support, why not just take tiff support from ImageMagick or tifflibrary(better), or even Java Advanced Imaging (excellent support for less common tiff compression schemes ) and integrate it in your app?

    I, for one, don't see the point in integrating complex libs with your app for just one small feature.


    Regards

  5. #5
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt + ImageMagick

    Yes, I use ImageMagick in my main application now, it works pretty fine, and
    it's not really that to use.

    If you want more details about it, I can send you a little sample showing how to load / convert / scale an image with Magick API.

    Guilugi.

    PS : but as wysota and marcel said, you don't need to use Magick if you need only TIFF support

  6. #6
    Join Date
    Aug 2006
    Posts
    90
    Thanks
    6
    Thanked 4 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt + ImageMagick

    I would like to use ImageMagick for TIFFs because I believe it supports more TIFF formats than what I can get out of QT. I also gain support for many other file formats that Qt does not support like PDF - cross platform.

    Guilugi,
    I would love to see an example of how you are using ImageMagick to display TIFFs.

  7. #7
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt + ImageMagick

    Okay,

    Here is a loader / viewer, I made it really simple.

    It uses Magick++ to load images.
    It's been a while since I used this Magick ++API, I prefer MagickWand (C library), I found it more efficient.

    So if you're not satisfied, I can always bring to you the C version

    Basically the steps :

    1 - Loading the image with a Magick object
    2 - Setting it to XPM format (not the best, ARGB might be better)
    3 - Displaying it with a QPixmap -> QLabel.

    This code works fine on Linux, I didn't check on Windows though, you'll probably need to link statically the Magick++ lib.

    Hope this helps,
    Guilugi.
    Attached Files Attached Files
    Last edited by guilugi; 19th April 2007 at 12:32.

  8. The following user says thank you to guilugi for this useful post:

    bpetty (23rd April 2007)

  9. #8
    Join Date
    Aug 2006
    Posts
    90
    Thanks
    6
    Thanked 4 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt + ImageMagick

    Thanks a lot for that snippet!

    I was really interested in what you were using to view the image. I knew about the qlabel but it always seemed a little odd to me. So I am pretty much just converting a TIF into another format, in memory, that the QLabel can display?

    I might see what it would be like to implement this using the QGraphicsView stuff in 4.2.

    I am also curious about MagickWand. Why do you like it better than Magick++?

  10. #9
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt + ImageMagick

    Yup that's it : I convert the image in PNG, so it can be opened through QPixmaps
    The conversion is a little time consuming in high resolutions, but for thumbnails it works really really good

    I'm currently using it through QGraphicsView to make a simple image editor (with basic layers), and so far it looks fine.

    For MagickWand :
    I had some problems at the beginning of my development (2 years 1/2 ago from now) with Magick++, mainly compilation and dynamic linking with MinGW...
    I couldn't use static linking in those days, couldn't use Visual Studio too (don't like it ), and dynamic linking was strictly forbidden with MinGW.

    So I switched on MagickWand : really simple to use too, maybe too simple, but it seemed loadings were faster with MagickWand...I can't tell anymore, it's pretty similar.

    If you can (want) to link statically to Magick++, you can use it, since it's object code, well fitted in Qt

    Hope this helps !

    Cheers,
    Guilugi.

Similar Threads

  1. Qt image support Issue in Installation?
    By vishal.chauhan in forum Installation and Deployment
    Replies: 2
    Last Post: 26th April 2007, 07:50
  2. Compile QT4.2.2 with MySQL on Mac OS
    By asd in forum Installation and Deployment
    Replies: 7
    Last Post: 12th February 2007, 14:50
  3. Replies: 2
    Last Post: 7th November 2006, 12:49
  4. How and when to repaint a widget ?
    By yellowmat in forum Newbie
    Replies: 7
    Last Post: 3rd April 2006, 16:36
  5. Question about updating an image on screen
    By SkripT in forum Qt Programming
    Replies: 1
    Last Post: 24th February 2006, 19:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.