GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / SetMRCPreserveSmoothing Method
Set this parameter to false to dramatically reduce produced file size, but get a less contrasting text. Otherwise set it to true.
Example





In This Topic
SetMRCPreserveSmoothing Method (GdPicturePDF)
In This Topic
Enables the use of enhanced smoothing technique when processing the image compression by the MRC engine, for example using the AddImageFromGdPictureImage(Int32,PdfAdvancedImageCompression) method.

Smoothing improves the contrast of the image by reducing noise. That means the produced image is less pixelated, but it's file size can increase. The predefined value is true.

Syntax
'Declaration
 
Public Sub SetMRCPreserveSmoothing( _
   ByVal PreserveSmoothing As Boolean _
) 
public void SetMRCPreserveSmoothing( 
   bool PreserveSmoothing
)
public procedure SetMRCPreserveSmoothing( 
    PreserveSmoothing: Boolean
); 
public function SetMRCPreserveSmoothing( 
   PreserveSmoothing : boolean
);
public: void SetMRCPreserveSmoothing( 
   bool PreserveSmoothing
) 
public:
void SetMRCPreserveSmoothing( 
   bool PreserveSmoothing
) 

Parameters

PreserveSmoothing
Set this parameter to false to dramatically reduce produced file size, but get a less contrasting text. Otherwise set it to true.
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 properties of the resulting image compressed using the MRC engine.
Dim caption As String = "Example: SetMRCPreserveSmoothing"
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: SetMRCPreserveSmoothing";
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