I'm having an
Code: Select all
GdPicture.GdPictureStatus.UnsupportedImageFormat
The multi tiff multipage, color, JPEG compressed at 65%, 300dpi
This is my code based on your sample:
Code: Select all
public void RotateImage(string imagePath, Pages pages, Rotation rotation)
{
GdPictureStatus status;
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
bool hasRotation = false;
int imageID = gdpictureImaging.CreateGdPictureImageFromFile(imagePath);
var compression = gdpictureImaging.GetTiffCompression(imageID);
status = gdpictureImaging.GetStat();
if (status == GdPictureStatus.OK)
{
int pageCount = gdpictureImaging.TiffGetPageCount(imageID);
for (int i = 1; i <= pageCount; i++)
{
if (i % 2 != (int)pages)
{
status = gdpictureImaging.TiffSelectPage(imageID, i);
if (status == GdPictureStatus.OK)
{
status = gdpictureImaging.RotateAngle(imageID, (int)rotation);
}
if (status != GdPictureStatus.OK)
{
break;
}
}
}
// THIS IS FAILING
var tmp = gdpictureImaging.TiffSaveMultiPageToFile(
imageID,
imagePath + "t",
compression,
65);
gdpictureImaging.ReleaseGdPictureImage(imageID);
// overwrite the original with the new copy
File.Copy(imagePath + "t", imagePath, true);
// delete the copy
File.Delete(imagePath + "t");
// is it possible to save the current open file directly without creating copies?
}
}
}
public enum Pages
{
Even=0,
Odd =1
}
public enum Rotation
{
_90 = 90,
_180 = 180,
_270 = 270
}
The project is targeting .NET 3.5
Thank you, best regards.
A.A.