Solved! It turns out that ConvertToGrayScale unloads the original DIB and replaces it with the new, gray scale version. Because fbmp was loaded using LockPage this causes problems later on when we UnlockPage and free mbmp. The solution is to clone fbmp and convert the clone to gray scale. Like this: mbmp.LockPage(page, fbmp); if (gray) then begin // It is necessary to clone fbmp here because ConvertToGrayScale // unloads the original DIB as part of the conversion process. // This causes access violations...
I am using the following code to open an TIFF file, read 1 page, convert it to grey scale and save it to a memory stream. I am using FreeImage 3.17 and the Delphi wrapper. procedure TImgStream.FILoadImage(fname: String; page: Integer; gray: Boolean); // Load the given page from a TIFF file into the memory buffer using FreeImage. var mbmp: TFreeMultiBitmap; fbmp: TFreeWinBitmap; begin WriteTrace(Format('TImgStream.FILoadImage fname=%s page = %d', [fname, page])); FFileName := ''; mbmp := TFreeMultiBitmap.Create;...
I am using the following code to open an TIFF file, read 1 page, convert it to grey scale and save it to a memory stream. I am using FreeImage 3.17 and the Delphi wrapper. procedure TImgStream.FILoadImage(fname: String; page: Integer; gray: Boolean); // Load the given page from a TIFF file into the memory buffer using FreeImage. var mbmp: TAurFreeMultiBitmap; fbmp: TAurFreeWinBitmap; begin WriteTrace(Format('TImgStream.FILoadImage fname=%s page = %d', [fname, page])); FFileName := ''; mbmp := TFreeMultiBitmap.Create;...
I am using what I believe to be the latest version of FreeImage. The version on the...
I finally figured it out. I had to use FreeImage_SetDotsPerMeterX & FreeImage_Se...
I am having trouble setting the X & Y Resolution TIFF tags. I am using the following...
I am creating tar archives using cygwin. When I open the archive in 7-zip every file...
Sample file