Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6582581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:17:52+00:00 2026-05-25T16:17:52+00:00

I have a problem creating a TIFF image with a JPEG compression using Magick++,

  • 0

I have a problem creating a TIFF image with a JPEG compression using Magick++, the C++ API of ImageMagick. When I use the convert tool the following way, it works:

convert 1.jpg -compress JPEG 1.tiff

When I want to do the same in C++, it looks like this:

Image img("1.jpg");
img.compressType(JPEGCompression);
img.write("1.tiff");

But this code does not work. It throws an exception when it tries to generate the file “1.tiff”:

Unhandled exception at 0x74ecb727 in test.exe: Microsoft C++ exception: Magick::ErrorCoder at memory location 0x002ffc2c..

It points to Line 103 in file Thread.cpp

Is this a bug or is something wrong with my code?

Update

I changed the code to this:

try{
    Image img(Desktop+"1.jpg");
    img.compressType(JPEGCompression);
    img.write(Desktop+"1.tiff");
}catch(Exception e){
    cout << e.what() << endl;
}

Output:
test.exe: CompressionNotSupported `JPEG’ @ error/tiff.c/WriteTIFFImage/2611

So… it seems to be not supported. The question is: Why does he convert tool support it then? Does someone know a way to do it?

Update

I’ve created an empty new project, recompiled ImageMagick and then added the following settings:

additional include dirs:

c:/imagemagick/magick++/lib;c:/imagemagick/

additional lib dirs:

c:/imagemagick/visualmagick/lib/

libs:

CORE_RL_bzlib_.lib;CORE_RL_coders_.lib;CORE_RL_filters_.lib;CORE_RL_jbig_.lib;CORE_RL_jp2_.lib;CORE_RL_jpeg_.lib;CORE_RL_lcms_.lib;CORE_RL_libxml_.lib;CORE_RL_magick_.lib;CORE_RL_Magick++_.lib;CORE_RL_png_.lib;CORE_RL_tiff_.lib;CORE_RL_ttf_.lib;CORE_RL_wand_.lib;CORE_RL_xlib_.lib;CORE_RL_zlib_.lib;CORE_RL_wmf_.lib;X11.lib;Xext.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;wsock32.lib;winmm.lib;

and then tried to run the following code:

#include <iostream>
#include <Magick++.h>

using namespace std;
using namespace Magick;

int main() {
    Image img("c:/users/patrik stutz/Desktop/1.jpg");
    img.compressType(JPEGCompression);
    img.write("c:/users/patrik stutz/Desktop/1.tiff");
    return 0;
}

And it worked!! All using VS2010. I have no clue why it didn´t work in my other project with the same settings…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:17:52+00:00Added an answer on May 25, 2026 at 4:17 pm

    According to ImageMagick Image Formats you need the jpegsrc.v8c.tar.gz for jpeg suppport. You have to link with libjpeg and libtiff to get it working. You can create all necessary linker flags using this command:

    Magick++-config --cppflags --cxxflags --ldflags --libs
    

    For me the following code is working:

    #include <Magick++.h>
    #include <iostream>
    using namespace std;
    using namespace Magick;
    
    int main() {
        Image img("1.jpg");
        img.compressType(JPEGCompression);
        img.write("1.tiff");
        return 0;
    }
    

    Using this compiler command:

    g++ -L/usr/lib -L/usr/lib/X11 -o"testim"  ./src/testim.o -lMagick++ -lMagickWand -lMagickCore -llcms -ltiff -lfreetype -ljpeg -llqr-1 -lglib-2.0 -lfontconfig -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lm -lgomp -lpthread -lltdl
    

    Update: I just saw that your error is originated by your tiff library. ImageMagick uses TIFFGetConfiguredCODECs() the get the supported compression codecs. So your tiff library has to support JPEG compression. Maybe you can try to update your tiff library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a problem creating photo album in facebook using android and graph API.
I have problem creating new instance of excel 2007 using VBA (from Access 2002).
I have problem with creating a simple MySQL trigger in C#. I'm using StringBuilder
I have a problem in creating a Button with text and image on it.
I am relatively new to using jQuery and I have a problem with creating
I have problem in creating tinyint field in MySQL database using Hibernate. I used
I have a problem with creating a pivot table in PostgreSQL using the crosstab()
I have problem when creating JSPs to use with Spring. I put all my
I'm using Matlab 7 and have a problem in creating a monoflop which shall
I have a problem creating a database schema for the following scenario: (I’m not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.