Re: Writing image to blob PNG vs TIFF
Bob Friesenhahn <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.help |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 18 Dec 2017, Robert H. Olsen wrote: > > // Create a formatted gm blob > Blob * pBlob = GetPBlob(); // points to space allocated elsewhere > gmimage.write(pBlob, GetGMType()); // GetGMType() returns either "PNG" or > "TIFF" > // gmimage.write(pBlob, "TIFF"); > // gmimage.write(pBlob, "PNG"); > > This works well for "PNG" but if the type is "TIFF" then the image at pBlob > is correct only the first time through after starting up or changing from PNG > mode, or if I change the number of times minify() is run on the image, > otherwise the image data is not changed though it should have been updated > when the new trigger was received. If I switch back to PNG everything is fine > again. Do TIFF and PNG deal with previously allocated space differently, or > something like that? Due to my decision to use STL containers to support multiple image frames, the Image read/write functions only support a single image frame. You must use the STL-based interfaces readImages() and writeImages() from Magick++/STL.h to deal with multiple frames. Please see http://www.graphicsmagick.org/Magick++/STL.html for documentation on how to use the STL-based interfaces. Unfortunately, this means that some of your code will need to be re-written. At the C language level, a sequence of image frames is represented by a linked list. For the C++ interface, these sequences (based on previous/next pointers) are broken (previous/next pointers set to NULL) and the STL container functionality is used to remember the relationship between frames. When the C++ interface calls into the C interface it must temporarily re-create a linked list of image frames (which it again destroys afterward). For this reason, you should not use multiple threads on the same STL container. Bob ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot