I have tried different graphic options such as… but have not able to clean the bitmap output.
rasterizationOptions.GraphicsOptions.InterpolationMode = InterpolationMode.NearestNeighbor
rasterizationOptions.GraphicsOptions.SmoothingMode = SmoothingMode.HighQuality
Does anyone have suggestions to help clear up the text when rendering to bitmap.
I have observed your comments. Can you please share source files and generated result so that may further investigate to help you out. Also please share which Aspose.CAD version you are using on your end.
Below is the simple code I am trying to do for an dxf out to bitmap…
Try
If Aspose.CAD.Image.CanLoad(sourceFilePath) Then
’ Load a CAD drawing in an instance of Image
'Using cadImage = Aspose.CAD.Image.Load(sourceFilePath)
Using cadImage As Aspose.CAD.FileFormats.Cad.CadImage = DirectCast(Aspose.CAD.Image.Load(sourceFilePath), Aspose.CAD.FileFormats.Cad.CadImage)
’ Create an instance of CadRasterizationOptions
Dim rasterizationOptions = New CadRasterizationOptions()
'set rasterization properties
rasterizationOptions.CenterDrawing = True
'Set the UnitType property
'rasterizationOptions.UnitType = UnitType.Millimeter
'rasterizationOptions.PageHeight = 1600
'rasterizationOptions.PageWidth = 1600
rasterizationOptions.AutomaticLayoutsScaling = True
' Set Graphics options
'rasterizationOptions.GraphicsOptions.InterpolationMode = InterpolationMode.HighQualityBicubic
'rasterizationOptions.GraphicsOptions.SmoothingMode = SmoothingMode.HighQuality
' Add the layer name to the RasterizationOptions's layer list
rasterizationOptions.Layers.Add("Print")
rasterizationOptions.Layers.Add("L1_RegMark")
rasterizationOptions.Layers.Add("L2_RegMark")
' Create an instance of BmpOptions class
Dim BmpOptions = New BmpOptions
'reate an instance of CadRasterizationOptions and set its various properties
BmpOptions.VectorRasterizationOptions = rasterizationOptions
BmpOptions.HorizontalResolution = 600
BmpOptions.VerticalResolution = 600
'BmpOptions.ResolutionSettings.VerticalResolution = 600
'BmpOptions.ResolutionSettings.HorizontalResolution = 600
'Set File name output string
Dim strFileName() As String = Split(_sourceFilePath, "\", -1, CompareMethod.Text)
Dim strTempFileName As String = strFileName.Last
Dim intLen As Integer = strTempFileName.Length
_FileName = Mid(strTempFileName, 1, (intLen - 4))
' Export each layer to Jpeg format
MyDir = MyDir & Convert.ToString(_FileName + ".bmp")
cadImage.Save(MyDir, BmpOptions)
End Using
Else
MsgBox("Drawing can not convert to bitmap: " & vbCr & sourceFilePath, vbOK, "Error Converting File")
End If
Catch ex As Exception
MsgBox("Drawing can not convert to bitmap." & vbCr & "Error: " & ex.Message, MsgBoxStyle.Critical, "Error Converting File")
End Try
Thank you for sharing the information. A ticket with ID CADNET-433 has been added in our issue tracking system to investigate the issue on our end. This thread has been associated with the issue so that we may share notification with you once issue will be fixed.
Any word when this issues will be fixed? We have a license and really need to resolve this so we can continue developing for this project. Is there a way we can pay for support on this issue to speed it up and help us fine tune our exports to bitmaps for print quality?
I like to inform that issue has been added recently in our issue tracking system. I also increased issue priority from medium to high and i have also requested our product team to share feedback regarding this issue. I request for your patience until further feedback is shared by our product team.
Size 10.pdf (31.0 KB) Example.zip (156.2 KB)
So here is the dxf file we would like to use as a standard layout for all the multiple product sizes our customer will be using. We are exporting the print layer name out to bitmap. That includes the bar code and mText letters out with the shape of the shoe. As you can see in the attached bitmap and pdf that shape also doesn’t follow as well around the poly-line with rendering when the file is cleanup and the number of vertices where reduced. There if you take a look at the dxf file and compare both the pdf and bitmap files you will see it’s not the same. We are need clean artwork output from the dxf file to bitmap for an digital printing application. Thanks.
I have observed the information shared by you and request you to please try using Aspose.CAD for .NET 17.9 on your end first. You can download the specified version from this Nuget source. If there is still an issue then please provide the sample code used on your end to obtain the shared output.
Files.zip (161.3 KB) controlData.png (7.4 KB)
Same issue! Is there a different way to set up the graphics options to improve the quality?
Sample Code
Private Sub CADLayersToRasterImageFormats()
Dim MyDir As String = “C:\Jobs\Job2969\Files\Bitmaps”
Try
If Aspose.CAD.Image.CanLoad(sourceFilePath) Then
' Load a CAD drawing in an instance of Image
'Using cadImage = Aspose.CAD.Image.Load(sourceFilePath)
Using cadImage As Aspose.CAD.FileFormats.Cad.CadImage = DirectCast(Aspose.CAD.Image.Load(sourceFilePath), Aspose.CAD.FileFormats.Cad.CadImage)
cadImage.UpdateSize()
' Create an instance of CadRasterizationOptions
Dim rasterizationOptions = New CadRasterizationOptions()
'set rasterization properties
rasterizationOptions.PageHeight = cadImage.Height
rasterizationOptions.PageWidth = cadImage.Width
' Set Graphics options
rasterizationOptions.GraphicsOptions.InterpolationMode = InterpolationMode.NearestNeighbor
rasterizationOptions.GraphicsOptions.SmoothingMode = SmoothingMode.HighQuality
' Add the layer name to the RasterizationOptions's layer list
rasterizationOptions.Layers.Add("Print")
rasterizationOptions.Layers.Add("L1_RegMark")
rasterizationOptions.Layers.Add("L2_RegMark")
' Create an instance of BmpOptions class
Dim BmpOptions = New BmpOptions
'reate an instance of CadRasterizationOptions and set its various properties
BmpOptions.VectorRasterizationOptions = rasterizationOptions
BmpOptions.HorizontalResolution = 96
BmpOptions.VerticalResolution = 96
'Set File name output string
Dim strFileName() As String = Split(_sourceFilePath, "\", -1, CompareMethod.Text)
Dim strTempFileName As String = strFileName.Last
Dim intLen As Integer = strTempFileName.Length
_FileName = Mid(strTempFileName, 1, (intLen - 4))
' Export each layer to Jpeg format
MyDir = MyDir & Convert.ToString(_FileName + "3.bmp")
cadImage.Save(MyDir, BmpOptions)
End Using
Else
MsgBox("Drawing can not convert to bitmap: " & vbCr & sourceFilePath, vbOK, "Error Converting File")
End If
Catch ex As Exception
MsgBox("Drawing can not convert to bitmap." & vbCr & "Error: " & ex.Message, MsgBoxStyle.Critical, "Error Converting File")
End Try
End Sub
Text and bar code is the biggest concern. Secondly, want know why the hidden lines with the scaled line for the dashes are not tracking what the Cad file has on them. Both the pdf and bmp rendering is doing the same thing.
I have tested the sample code shared by you using shared DWG and have been able to observe the lines related issue shared by you. A ticket with ID CADNET-443 has been added in our issue tracking system to resolve the issue. Moreover, I suggest you to please try using following alternate in your sample code to improve the quality of rendered text. This applies to both issue linked with this thread.
That works. Thanks for the tip. Does that keep the correct size of the image? Meaning if it was 1 inch square and printed it to scale it would print a 1 inch square.
Secondly, the text and bar code renders great now. However, dash lines which are hidden line is not following the polyline correctly from Cad. Any suggestion on why it’s not? Look at the attached images. You will notice that cad file has arc and the bitmap is straight to next vertice.
We have initially investigate the issue related lines rendering on our end. Can you please share the clarification for solid lines getting rendered as dashed. Please observe this image link which shows comparison of dashed blue lines in CAD viewer with that in generated PDF. Both are identical and there is no issue in it. Moreover, can you please provide the comparison image for “The dash lines which are hidden line are not following the polyline correctly from Cad”. Can you please share the elaboration for these.