Hello,

 

imho I found an error in the jpeg image writer method. I have observed
that on writing images of this type the resolution I have set in my
Image object is not visible in the written file. After inspection I
think that a couple of code lines in OSGJPGImageFileType.cpp at line 532
should be moved after the jpeg_set_defaults(&cinfo); call.

 

I.e. it should be something like...

 

 

/*

    cinfo.density_unit = 1;  // dpi

    cinfo.X_density = UInt16(pImage->getResX() < 0.0f ?

                             pImage->getResX() - 0.5f :

                             pImage->getResX() + 0.5f);

    cinfo.Y_density = UInt16(pImage->getResY() < 0.0f ?

                             pImage->getResY() - 0.5f :

                             pImage->getResY() + 0.5f);

*/

    jpeg_create_compress(&cinfo);

 

    DestinationManager *destinationManager =

        new ((*cinfo.mem->alloc_small)(j_common_ptr(&cinfo), 

                                       JPOOL_IMAGE, 

                                       sizeof(DestinationManager)))

        DestinationManager(&cinfo, os);

 

    cinfo.dest =
reinterpret_cast<jpeg_destination_mgr*>(destinationManager);

 

    jpeg_set_defaults(&cinfo);

 

    cinfo.density_unit = 1;  // dpi

    cinfo.X_density = UInt16(pImage->getResX() < 0.0f ?

                             pImage->getResX() - 0.5f :

                             pImage->getResX() + 0.5f);

    cinfo.Y_density = UInt16(pImage->getResY() < 0.0f ?

                             pImage->getResY() - 0.5f :

                             pImage->getResY() + 0.5f);

 

    cinfo.image_width = pImage->getWidth();

    cinfo.image_height = pImage->getHeight();

    cinfo.input_components = pImage->getBpp();

    cinfo.in_color_space = (pImage->getBpp() == 1) ? JCS_GRAYSCALE :
JCS_RGB;

 

Could someone please check and change the code base.

 

Best,

Johannes

 


------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to