Next LUG meet: 12 Oct 2003 around 4 pm - VJTI Computer Centre
-------------------------------------------------------------
Hi Friends,
    I have to manipulate ( rotate ) a tiff file having 5600 x 6600
pixels.
For that I created a pixbuf from file

    Glib::RefPtr<Gdk::Pixbuf> m_ppixBuf;   
    m_ppixBuf = Gdk::Pixbuf::create_from_file(filename );

 int lHeight = m_ppixBuf->get_height();
 int lWidth = m_ppixBuf->get_width();
 int lRotatedRowStride = m_ppixBuf->get_rowstride();

Then collected data in a local variable,
    gchar* pixdata = m_ppixBuf->get_pixels();

Allocating equivalent memory to one temporary variable
    gchar* tmpdata = (char *) malloc( lHeight * lWidth *
lNo_of_channels);

Then coying pixels one by one from source to target using memcpy
function.

// case 90 degree :
           
        for(j = 0, k = (lHeight-1); j < lHeight; j++, k--)
        {                  
            for(i = 0; i < lWidth; i++)
            {
                memcpy(&tmpmap[i * lRotatedRowStride + k * 
iNo_of_Channel], &bitmap[j * lRowstride + i * iNo_of_Channel], 
iNo_of_Channel);      
            }       
        }

This code works fine , but takes lot of time to rotate large image.

Is there any other way to make this operation faster?

Also I want to save modified pixbuf in "tiff" file, but GDK library 
allows me to save only in PNG and JPEG format.
How will I save it in tiff format?

If anyone knows please help me.

Thanks,
Ramachandra
 
--
http://mm.ilug-bom.org.in/mailman/listinfo/linuxers

Reply via email to