🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: be.comp.programming
2 messages
2 total messages Started by Codaria Fri, 06 Jun 2003 10:05
Images in VB.NET
#5130
Author: Codaria
Date: Fri, 06 Jun 2003 10:05
91 lines
4505 bytes
This is a multi-part message in MIME format.

------=_NextPart_000_0008_01C32C23.EFAB6310
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hallo,

Ik heb de volgende sub:

Private Sub SaveImage(ByVal strId As String, ByVal strAfbeelding As =
String)
Dim imgAfbeelding, imgThumb As System.Drawing.Image
Dim inp As New IntPtr()

imgAfbeelding =3D Image.FromFile(strAfbeelding)

imgThumb =3D imgAfbeelding.GetThumbnailImage(75, 50, Nothing, inp)

imgThumb.Save("c:\test_small.jpg", Imaging.ImageFormat.Jpeg)

imgAfbeelding.Save("c:\test_big.jpg", Imaging.ImageFormat.Jpeg)  Op deze =
regel kijg ik altijd de volgende fout:
                   An unhandled exception of type =
'System.Runtime.InteropServices.ExternalException' occurred in =
system.drawing.dll
                   Additional information: A generic error occurred in =
GDI+.=20

imgAfbeelding.Dispose()
imgThumb.Dispose()
End Sub

Wat doe ik mis en vooral hoe kan ik deze fout oplossen?

Hartelijk dank
------=_NextPart_000_0008_01C32C23.EFAB6310
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1170" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hallo,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Ik heb de volgende sub:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><FONT color=3D#0000ff>Private Sub =
SaveImage(ByVal=20
strId As String, ByVal strAfbeelding As String)<BR></FONT>Dim =
imgAfbeelding,=20
imgThumb As System.Drawing.Image<BR>Dim inp As New =
IntPtr()<BR><BR>imgAfbeelding=20
=3D Image.FromFile(strAfbeelding)<BR><BR>imgThumb =3D=20
imgAfbeelding.GetThumbnailImage(75, 50, Nothing,=20
inp)<BR><BR>imgThumb.Save("c:\test_small.jpg",=20
Imaging.ImageFormat.Jpeg)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT><BR><FONT face=3DArial=20
size=3D2>imgAfbeelding.Save("c:\test_big.jpg", =
Imaging.ImageFormat.Jpeg)&nbsp;=20
<FONT color=3D#ff0000>Op deze regel kijg ik altijd de volgende=20
fout:</FONT></FONT></DIV>
<DIV><FONT face=3DArial color=3D#ff0000=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
An unhandled exception of type=20
'System.Runtime.InteropServices.ExternalException' occurred in=20
system.drawing.dll</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT=20
color=3D#ff0000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
Additional information: A generic error occurred in=20
GDI+.&nbsp;<BR></FONT><BR>imgAfbeelding.Dispose()<BR>imgThumb.Dispose()<B=
R><FONT=20
color=3D#0000ff>End Sub</FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Wat doe ik mis en vooral hoe kan ik =
deze fout=20
oplossen?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Hartelijk =
dank</FONT></DIV></BODY></HTML>

------=_NextPart_000_0008_01C32C23.EFAB6310--
Re: Images in VB.NET
#5131
Author: Pieter Philippaerts
Date: Fri, 06 Jun 2003 14:42
20 lines
2122 bytes
"Codaria" <codaria@hotmail.com> wrote in message
> Wat doe ik mis en vooral hoe kan ik deze fout oplossen?
> imgThumb = imgAfbeelding.GetThumbnailImage(75, 50, Nothing, inp)

Ik weet niet of het er iets te maken heeft met de fout die je krijgt, maar
de documentatie zegt expliciet dat de derde parameter _geen_ null referentie
mag zijn ["A Image.GetThumbnailImageAbort delegate. In GDI+ version 1.0, the
delegate is not used. Even so, you must create a delegate and pass a
reference to that delegate in this parameter"].

Als het na deze aanpassing nog niet werkt, dan moet je eens proberen ofdat
het opslaan in een ander bestandstype wel gaat [probeer eens op te slaan
naar een BMP of PNG file, bijvoorbeeld]. Als dat wel werkt, dan is het
mogelijk dat de tekening niet als JPEG kan opgeslagen worden [misschien is
het een 256-kleuren tekening].

Buiten dat zie ik niet meteen problemen met de code.

Mvg,
Pieter Philippaerts
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads