GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / SetMRCImageBackgroundResolution Method
The required resolution of the background layer of the resulting image produced by the MRC engine.

Set this parameter to -1, if you want to use the original resolution of the input image.

Example





In This Topic
SetMRCImageBackgroundResolution Method (GdPicturePDF)
In This Topic
Sets the resolution of the background layer of the image, which is subsequently processed by the MRC engine, for example using the AddImageFromGdPictureImage(Int32,PdfAdvancedImageCompression) method.

The predefined value is -1, which means that the original resolution of the input image is used.

Syntax
'Declaration
 
Public Sub SetMRCImageBackgroundResolution( _
   ByVal Resolution As Single _
) 
public void SetMRCImageBackgroundResolution( 
   float Resolution
)
public procedure SetMRCImageBackgroundResolution( 
    Resolution: Single
); 
public function SetMRCImageBackgroundResolution( 
   Resolution : float
);
public: void SetMRCImageBackgroundResolution( 
   float Resolution
) 
public:
void SetMRCImageBackgroundResolution( 
   float Resolution
) 

Parameters

Resolution
The required resolution of the background layer of the resulting image produced by the MRC engine.

Set this parameter to -1, if you want to use the original resolution of the input image.

Remarks
This attribute is only relevant when compressing images using the MRC Compression mechanism.

Just to inform you, that this value is valid continuously when processing each image until you change it. It is not related to the currently loaded document.

Example
How to affect the resolution of the background layer of the image compressed using the MRC engine.
Dim caption As String = "Example: SetMRCImageBackgroundResolution"
Dim gdpictureImaging As GdPictureImaging = New GdPictureImaging()
Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg")
If gdpictureImaging.GetStat() = GdPictureStatus.OK Then
    Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    If gdpicturePDF.NewPDF() = GdPictureStatus.OK Then
        gdpicturePDF.SetMRCImageBackgroundResolution(100)
        gdpicturePDF.SetMRCPreserveSmoothing(True)
        If gdpicturePDF.AddImageFromGdPictureImage(imageID, PdfAdvancedImageCompression.PdfAdvancedImageCompressionMRC) = GdPictureStatus.OK Then
            If gdpicturePDF.SaveToFile("image.pdf", True) = GdPictureStatus.OK Then
                MessageBox.Show("The image has been added successfully and the file has been saved.", caption)
            Else
                MessageBox.Show("The CreateGdPictureImageFromFile() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption)
            End If
        Else
            MessageBox.Show("The AddImageFromGdPictureImage() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
        End If
    Else
        MessageBox.Show("The NewPDF() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
    End If
    gdpicturePDF.Dispose()
Else
    MessageBox.Show("The CreateGdPictureImageFromFile() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption)
End If
gdpictureImaging.ReleaseGdPictureImage(imageID)
gdpictureImaging.Dispose()
string caption = "Example: SetMRCImageBackgroundResolution";
GdPictureImaging gdpictureImaging = new GdPictureImaging();
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg");
if (gdpictureImaging.GetStat() == GdPictureStatus.OK)
{
    GdPicturePDF gdpicturePDF = new GdPicturePDF();
    if (gdpicturePDF.NewPDF() == GdPictureStatus.OK)
    {
        gdpicturePDF.SetMRCImageBackgroundResolution(100);
        gdpicturePDF.SetMRCPreserveSmoothing(true);
        if (gdpicturePDF.AddImageFromGdPictureImage(imageID, PdfAdvancedImageCompression.PdfAdvancedImageCompressionMRC) == GdPictureStatus.OK)
        {
            if (gdpicturePDF.SaveToFile("image.pdf", true) == GdPictureStatus.OK)
                MessageBox.Show("The image has been added successfully and the file has been saved.", caption);
            else
                MessageBox.Show("The CreateGdPictureImageFromFile() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption);
        }
        else
            MessageBox.Show("The AddImageFromGdPictureImage() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
    }
    else
        MessageBox.Show("The NewPDF() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
    gdpicturePDF.Dispose();
}
else
    MessageBox.Show("The CreateGdPictureImageFromFile() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption);
gdpictureImaging.ReleaseGdPictureImage(imageID);
gdpictureImaging.Dispose();
See Also