Free Support Forum - aspose.com

Dxf to jpeg is too light can barely see it

Hi,

I am doing some testing and converted dxf to jpeg. It works but the picture is so light you can barely see it. How can i make the jpeg darker?

  Dim strInputFile = txtFilePath.Text
        Dim strOutputFile = String.Empty
        Dim strErrors = String.Empty
        Dim strFileName = IO.Path.GetFileName(strInputFile)
        Dim intIndex As Integer

        If strFileName.ToLower.Contains("dxf") Then
            intIndex = strFileName.ToLower.IndexOf(".dxf")
        Else
            intIndex = strFileName.ToLower.IndexOf(".dwg")
        End If

        strFileName = strFileName.Substring(0, intIndex).Trim()

        Try
            Using objCADImage As Aspose.CAD.Image = Aspose.CAD.Image.Load(strInputFile)

                ' Create an instance of CadRasterizationOptions
                Dim objCADRasterizationOptions As New Aspose.CAD.ImageOptions.CadRasterizationOptions()

                ' Set page width & height
                objCADRasterizationOptions.PageWidth = 1500
                objCADRasterizationOptions.PageHeight = 1500
                objCADRasterizationOptions.AutomaticLayoutsScaling = True
                'objCADRasterizationOptions.ScaleMethod = FileFormats.Cad.ScaleType.GrowToFit
                objCADRasterizationOptions.BorderX = 10
                objCADRasterizationOptions.BorderY = 10
                objCADRasterizationOptions.CenterDrawing = True

                ' Create an instance of JpegOptions for the resultant image
                Dim objJPegOptions As ImageOptionsBase = New Aspose.CAD.ImageOptions.JpegOptions()

                ' Set rasterization options
                objJPegOptions.VectorRasterizationOptions = objCADRasterizationOptions

                strOutputFile = modAppInfo.ProductReportPath & "\" & strFileName & ".jpg"

                Try
                    'If output file already exists, delete it first
                    If IO.File.Exists(strOutputFile) Then
                        My.Computer.FileSystem.DeleteFile(strOutputFile, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin)
                    End If

                Catch ex As Exception
                    strErrors = "There was a problem deleting the previously existing jpeg file (" & strFileName & ") from the storage folder."
                    WriteToErrorLog(ex.Message, ex.StackTrace)
                End Try

                ' Save resultant image
                If strErrors.Length.Equals(0) Then
                    objCADImage.Save(strOutputFile, objJPegOptions)

                    txtFilePath.Text = strOutputFile
                End If
            End Using

        blnSetPartNumber = True
        rbSelectJPEG.Checked = True
        blnSetPartNumber = False

        SetPartNumber()

        Catch ex As Exception
            strErrors = "There was a problem creating the JPEG file."
            WriteToErrorLog(ex.Message, ex.StackTrace)
        End Try

        If Not strErrors.Length.Equals(0) Then
            MessageBox.Show("There was a problem during the file conversion process." & vbNewLine & vbNewLine & strErrors, "File Conversion Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If

@knowlegecad,

I have observed your comments. Can you please share source files along with generated result so that we may further investigate to help you out. Also please share Aspose.CAD version along with environment details.