473,408 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

GDI+ and SAVE JPG or BMP on the server

Ada
First of all, I thought this might be a directory security issue but it's not.
I was able to upload the file to the directory via HTTP.

Here's the situation.
I have a JPG file on my server.
..../images/myPIC.jpg

I wanted to draw a box or line using GDI+ on top of myPIC.jpg and then save
the new image to the server.

I was able to draw and display the image on screen but somehow cannot figure
out how to save it to the server.

The code below allows the result to be displayed on screen and it works fine.

newBMP.Save(Response.OutputStream, ImageFormat.Jpeg);

Something else is strange with the above image. When I RIGHT-CLICK and
attempted to save the image, the image cannot be saved. Although it displays
on screen but somehow I cannot copy the image using the RIGHT-CLICK.

Below is the code I used to save the image to the server....

newBMP.Save(Server.MapPath("images/" + "myNewPIC.jpg");
Got the following error:

[ExternalException (0x80004005): A generic error occurred in GDI+.]
System.Drawing.Image.Save(String filename, ImageCodecInfo encoder,
EncoderParameters encoderParams) +578
System.Drawing.Image.Save(String filename, ImageFormat format) +59
System.Drawing.Image.Save(String filename) +24

Mar 19 '06 #1
2 2632
> [ExternalException (0x80004005): A generic error occurred in GDI+.]

99.9% of the time, when using GDI, 'a generic error occured' means that the
directory you are trying to save to doesn't ahve the proper permissions.
Typically, you need to make sure that directory is allowing asp.net to
modify files.

-Darrel
Mar 20 '06 #2
Ada
That's what I thought so.
However, I was able to upload file to the directory.
If dir permission doesn't allow READ and WRITE, I would think I wouldn't be
able to upload anything there.

If I added IMAGE control to the web form and allow the result to display in
the IMAGE control, the same SAVE code works.

My goal is that I don't want to display the result on screen.
The practical application would be something like a WATERMARK.
May be I have a TEXTBOX control and allow the ASP.NET and GDI+ to draw a
string on an image(s).
And if necessary, display the result on screen plus save the same result on
the server.


"Darrel" wrote:
[ExternalException (0x80004005): A generic error occurred in GDI+.]


99.9% of the time, when using GDI, 'a generic error occured' means that the
directory you are trying to save to doesn't ahve the proper permissions.
Typically, you need to make sure that directory is allowing asp.net to
modify files.

-Darrel

Mar 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Nathan Sokalski | last post by:
I am trying to create graphics with GDI+ that include transparency. However, the transparency never seems to show up, even though my colors have an alpha value of 0. How can I generate a graphic...
2
by: Alphonse Giambrone | last post by:
I am currently reading 'Programming The Web with Visual Basic .NET' and have so far found it to be excellent. Downloaded all the code from Apress and working in chapter 4, I get the error shown...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.