EPS looks "blobby"

M

Mike Dole

I'm writing and reading EPS pictures in a dataset with the following 2
functions:

Public Function SavePhoto(ByVal MyfileName As String) As Boolean
Try
FotoResult = Nothing
If Len(MyfileName) > 0 Then
Dim fs As FileStream = New FileStream(MyfileName, _
FileMode.OpenOrCreate, FileAccess.Read,
FileShare.ReadWrite)
Dim rawData() As Byte = New Byte(fs.Length) {}
ReDim FotoResult(fs.Length)

fs.Read(rawData, 0, System.Convert.ToInt32(fs.Length))
fs.Close()
FotoResult = rawData
SavePhoto = True
End If
Catch ex As System.Exception
MsgBox(ex.ToString)
SavePhoto = False
End Try
End Function

Public Sub GetPhoto(ByVal MyPhoto As String, ByVal MyPicBox As
PictureBox, ByVal MyRow As DataRow)
Try
Dim CurImage As Image = Nothing

If Not IsDBNull(MyRow(MyPhoto)) Then
Dim MyData() As Byte
MyData = MyRow(MyPhoto)
Dim K As Long
K = UBound(MyData)


Dim fs As New FileStream("c:\" & MyPhoto & ".eps", _
FileMode.Create, FileAccess.Write,
FileShare.ReadWrite)

fs.Write(MyData, 0, K)
fs.Close()
fs = Nothing

' Display image
CurImage = Image.FromFile("c:\" & MyPhoto & ".eps")
MyPicBox.Image = New Bitmap(CurImage)
MyPicBox.Invalidate()
'Object weer leegmaken
CurImage.Dispose()
CurImage = Nothing
Else
MyPicBox.Image = Nothing
End If
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub

I've tried to use jpg at first because I can't hook an EPS file up to
a picturebox (It says so in the example, but it won't work..)

Anyway I can pick a EPS picture save it to a field in a datarow,
printout a cr.net report with a blob field with the EPS pic in it but:

The quality's no good... it almost looked better when I used the .jpg
files...

So at the moment I've got 2 problems:
- How can I improve the quality of the blob pictures on the report
- Along the way: does anybody know if I can use the imageconverter
object or something else to write the EPS to a filestream (like in the
function below) and use the file with a picturebox?

Thanks in advance,

Mike
 
R

Rod Hewitt

(e-mail address removed) (Mike Dole) wrote in
I'm writing and reading EPS pictures in a dataset with the following 2
functions:

Public Function SavePhoto(ByVal MyfileName As String) As Boolean
Try
FotoResult = Nothing
If Len(MyfileName) > 0 Then
Dim fs As FileStream = New FileStream(MyfileName, _
FileMode.OpenOrCreate, FileAccess.Read,
FileShare.ReadWrite)
Dim rawData() As Byte = New Byte(fs.Length) {}
ReDim FotoResult(fs.Length)

fs.Read(rawData, 0, System.Convert.ToInt32(fs.Length))
fs.Close()
FotoResult = rawData
SavePhoto = True
End If
Catch ex As System.Exception
MsgBox(ex.ToString)
SavePhoto = False
End Try
End Function

Public Sub GetPhoto(ByVal MyPhoto As String, ByVal MyPicBox As
PictureBox, ByVal MyRow As DataRow)
Try
Dim CurImage As Image = Nothing

If Not IsDBNull(MyRow(MyPhoto)) Then
Dim MyData() As Byte
MyData = MyRow(MyPhoto)
Dim K As Long
K = UBound(MyData)


Dim fs As New FileStream("c:\" & MyPhoto & ".eps", _
FileMode.Create, FileAccess.Write,
FileShare.ReadWrite)

fs.Write(MyData, 0, K)
fs.Close()
fs = Nothing

' Display image
CurImage = Image.FromFile("c:\" & MyPhoto & ".eps")
MyPicBox.Image = New Bitmap(CurImage)
MyPicBox.Invalidate()
'Object weer leegmaken
CurImage.Dispose()
CurImage = Nothing
Else
MyPicBox.Image = Nothing
End If
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub

I've tried to use jpg at first because I can't hook an EPS file up to
a picturebox (It says so in the example, but it won't work..)

Anyway I can pick a EPS picture save it to a field in a datarow,
printout a cr.net report with a blob field with the EPS pic in it but:

The quality's no good... it almost looked better when I used the .jpg
files...

So at the moment I've got 2 problems:
- How can I improve the quality of the blob pictures on the report
- Along the way: does anybody know if I can use the imageconverter
object or something else to write the EPS to a filestream (like in the
function below) and use the file with a picturebox?

Thanks in advance,

Mike

I know nothing about your problem - but could it be that you are actually
seeing a jpeg thumbnail of the photo rather than the fully rendered EPS?
That is a fairly common cause of problems when viewing certain types of
graphic file. And it would explain the poor image quality - the thumbnails
are only there to make it easy to identify the image when for example,
pasted into a document. But the quality is not intended to be sufficient
for printing.

I sincerely doubt that EPS is the optimum approach here unless you are
preparing for high quality (e.g. commercial) printing. I reiterate that I
don't understand your problem, but it seems to me that jpeg or png are far
less likely to cause problems.
 
R

rikesh

I had no idea that CR supported EPS images!!!?


Rod Hewitt said:
(e-mail address removed) (Mike Dole) wrote in


I know nothing about your problem - but could it be that you are actually
seeing a jpeg thumbnail of the photo rather than the fully rendered EPS?
That is a fairly common cause of problems when viewing certain types of
graphic file. And it would explain the poor image quality - the thumbnails
are only there to make it easy to identify the image when for example,
pasted into a document. But the quality is not intended to be sufficient
for printing.

I sincerely doubt that EPS is the optimum approach here unless you are
preparing for high quality (e.g. commercial) printing. I reiterate that I
don't understand your problem, but it seems to me that jpeg or png are far
less likely to cause problems.
 
M

Mike Dole

I had no idea that CR supported EPS images!!!?

Guess it does, I can store it in a field, extract it to a temp.eps
open this temp.eps in a third party app and print it with cr.net.

Strange thing I noticed is that when I print the (every) EPS file with
paint shop pro I'm also having problems printing... Quality is
terrible.
If I however insert it in an excel document as an ole object it prints
out fine.

It's getting a bit Off topic I'm afraid, I'd better give this one
up...

Thanks for your help so far guys!

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top