System.Drawing Bug in Mono resolution.

Hello all,

For any of you that have been following my post regarding storing images into MYSQL on a mono based platform. I found a solution to my problem, and it was a simple as anything.

Just to recap. My problem involved Mono's buggy System.Drawing class. I am running Mono on Fedora 2 (I know pretty old, but works a treat).  My task was to create a new bitmap from an existing Jpeg, edit it and then save it to an absolute path on my server. The first problem I encountered was with the Bitmap.Save function

System.Drawing.Bitmap newBit = new System.Drawing.Bitmap.FromFile("image.jpg");

newBit.Save("newFilename", ImageFormat.Jpeg);

//The above code results in a GDI error.

Faced with this problem, i decided to look for an alternative solution to my problem. Mono isnt perfect, but amazing enough to still use it despite its bugs. My attention turned to MYSQL. I was browing some articles a few days ago and saw an article on saving and reading images to and from a MYSQL database using I read the tutorial, and although it wasnt the clearest article in the world, i got the Jist.

I started building some functions to add the image to the database and to read the bytes from an image to input into my SQL statement. Low and behold, another error arose, my linux box came to a screaming halt and gurgelled another error: Something about cannot write to stream. I figured that the output was too large, since the image i was dealing with was pretty hefty, 50KB +, mono didnt allow it. I searched high and low for a solution.

My main aim was to edit a bitmap and return it was a jpeg to create an image map out of. I started programming with PHP some time ago, so whilst browsing PHPbuilder i came across and article about displaying images from a DB. The PHP code was pretty simple and simply involved accessing the database, setting the header content type and that was it. Using PHPMYADMIN to upload an image to my LONGBLOB field in my images DB, i uploaded a 30KB jpeg to test with. I ran the script and there was the JPEG in pristine condition.

With this script in tact and  working in PHP, i decided on translating it to ASP.NET using the same methodology hoping this would solve my problem of using the image as an image map. I looked towards creating the bitmap and just outputing it whenever i needed it without saving it anywhere.

<%@ Page Language="C#" AutoEventWireup="true" Src="treePlot.cs" Inherits="TreePlot" %>

<%@ Import Namespace="System.Drawing.Drawing2D" %>

<%@ Import Namespace="System.Drawing.Imaging" %>

<%@ Import Namespace="System" %>

<%@ Import Namespace="System.IO" %>


//Below calls  one of my classes that simply returns a bmp.

TreePlot newImage = new TreePlot();

System.Drawing.Bitmap newBit = newImage.plotZipcodes();

Response.ContentType = "image/jpeg";

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


I saved this script as imageGen.aspx. With this script you can now call the image from your HTML or ASP image control

e.g. <img src= border=0 />

I guess this is just information for those using Mono, i hope someone can save the countless hours i lost fixing this dilema. Its an alternative to saving to a DB or an absolute path, even if you have to lose a few miliseconds in processing time.

peace out


1/11/2006 6:12:40 AM 851 articles. 0 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 49


Similar Artilces:

is .net framework 1.1 same as .net framework SDK 1.1
is .net framework 1.1 same as  .net framework SDK 1.1 Basically Framework 1.1 of .NET includes the Sofware Development Kit (SDK) 1.1 Regards,Vinz"Code, Beer and Music" that's my way of being a programmer!How to get your Forum Question Answered | Blog | CodeASP.NET I think .net framework 1.1 is just the runtime library to view .net 1.1 programs.  the .net framework SDK 1.1 one is the actual development library used to create them.   Eri...

Why include LUNs in 1:1:1:1 ?
Hi Having installed several clusters and fully understanding and accepting the NetWare partition:pool:volume 1:1:1 relationship I would like to understand this latest fad of adding the LUN assignment into the relationship?!? I've always assigned the amount of space required for a particular OS cluster into a LUN and then masked that to the appropriate hosts, where it is then split into partitions, etc. What are the benefits for having multiple LUNs? Presumably you still have a single RAID (5,10, whatever) group under it? Aren't you just putting more stress on the st...

[ 1.1.3870.1 ]
Gang... THIS is the one I meant! <g> It WON'T EVER annoy anyone who has built themselves a {default}.ini file even if that file and the benchmark are only testing DNSB's built-in resolvers. :) -- ________________________________________________________________ Steve. Working on: GRC's DNS project pages. Nicely done :) I like the new improvements, and DNSB is feeling more like a finished product again ;) By the way, when I clicked on "Tell me more" bu...

superreview cancelled: [Bug 317498] Back port JSS tests from tip to 4.1.1 to enable test failure reporting : [Attachment 204006] Back ported JSS tests from tip (4.2) to 4.1.1
Sandeep Konchady <Sandeep.Konchady@Sun.COM> has cancelled Sandeep Konchady <Sandeep.Konchady@Sun.COM>'s request for superreview: Bug 317498: Back port JSS tests from tip to 4.1.1 to enable test failure reporting Attachment 204006: Back ported JSS tests from tip (4.2) to 4.1.1 ------- Additional Comments from Sandeep Konchady <Sandeep.Konchady@Sun.COM> Changes done to test source [1] : added "Mozilla-JSS" provider ...

superreview requested: [Bug 317498] Back port JSS tests from tip to 4.1.1 to enable test failure reporting : [Attachment 204006] Back ported JSS tests from tip (4.2) to 4.1.1
Sandeep Konchady <Sandeep.Konchady@Sun.COM> has asked glen beasley <> for superreview: Bug 317498: Back port JSS tests from tip to 4.1.1 to enable test failure reporting Attachment 204006: Back ported JSS tests from tip (4.2) to 4.1.1 ------- Additional Comments from Sandeep Konchady <Sandeep.Konchady@Sun.COM> Back ported JSS tests from tip (4.2) to 4.1.1 --------------------------------------------------------- Checking...

Differences between .net 1, .net 1.1, .net 2.0 and .net 3.0
Hi, This seems to be a common question, but i havent got an answer yet:(Can, any one please explain me the differences between these versions.If you keep your feet firmly on the ground, you'll have trouble putting on your pants! Have a look into this links Rajawww.iGold.inDon't forget to click "Mark as Answer" on the post that helped you. This credits that m...

Bug 331425 fixed in 1.1.1?
In Bug 331425 [AOL IMAP] Sender and Recipient columns only show sender... is listed as fixed. I am using Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv: Gecko/20070222 SeaMonkey/1.1.1 with adblockplus, noscript and LiveHTTPheaders. In my AOL IMAP Inbox folder and all subfolders of the Saved folder the Recipient column shows the From name instead of the To name. Can anyone else confirm this? Was Bug 331425 really fixed in SeaMonkey 1.1.1? Should I reopen Bug 331425? ...

.NET 1.0 vs 1.1
I am using DNN 1.0.10c. Whenever I make changes to the source code, I recompile it with Visual Studio .net and the .NET Framework 1.0. I also have Visual Studio .NET 2003 available to me. Is it safe for me to use this version of VS, as then I can take advantage of the 1.1 version of the framework? Or is DNN not 1.1 & vs2003 compatable? Thanks! I installed 1.1 as soon as it came out and use it with VS 02 with no issue to report. Recently I installed 03 and I don’t have any issue with that either. However, Colleague still runs VS02 so I am still running 02 on some of the pr...

MasterPages for NET 1.0 / 1.1
Hi all This template engine for .NET 1.0 / 1.1 allows you to render the contents of your web forms as parts of a MasterPage (template). It's extremely easy to use and provides full designer support. The engine is component based - unlike other engines, it keeps your HTML clean and you don't have to rearrange your web forms. This prevents you from scattering additional HTML all over your web application and enforces a clean separation of design and development. I've published an article regarding it's use @ codeproject where you also find the source and a demo project: ht...

.NET Framework 1.0 and 1.1
If a .NET application has been developed under .NET Framework 1.0, are there any problems when deploying the application in a system running Framework 1.1? Please advise. From my knowledge there is no problem; in .Net back ward compatibility is there! Sreedharhttp://www.w3coder.orgweblog no problem as long as you have the configuration file with all the dll mapping stuff right.Christian CalderonNeed to work in Classic ASP? then do it the right way with CLASP!Classic ASP Framework I don't English. hi... im using windows xp pro, visual, an...

IIS 5.1 And .net 1.1
I've got everything installed I think. I'm running Windows XP Professional, Visual Studio .net 2003, the .net Framework 1.1 and IIS 5.1. Every time I try to create a new project, I get an error that says: "Visual Studio .net has detected that the specified Web Server is not running ASP.NET version 1.1. You will be unable to run ASP.NET Web Applications or services." Help?? Please :) -MJC i've had the same problem. I unistalled all the framework stuff en installed again. Now that part works! But wen i try to browse my localhost its says: "Can't find the s...

for i = 1 to 1
I am new to PowerBuilder, so I am not 100% sure of the answer to this question. I found this for loop in a program: for i = 1 to 1 . I am thinking that that was someone's cute way of never executing this code, rather than the oh so obvious and easy way that powerbuilder allows you to comment out code. Anyway, the question is does the code in this for loop execute once or never? Thanks in advance for your help, Dawn Once, with the value i = 1. It's a cute way of doing something; what that something is, I have no idea. Wasting time? Driving up your code line count? &...

Name: kid Email: lathotmaildotcom Product: Gran Paradiso Alpha 8 Summary: 1+1 Comments: .................. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; th; rv: Gecko/2008100205 GranParadiso/3.0.4pre From URL: Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

Confused! DNN 1.0.10 on .NET 1.0 or 1.1?
What version of ASP.Net should I be running DNN 10.0.1d on? Currently i am running it on 1.0 on both test server and live, but this means that some 3rd party modules will not work and i get the "File or assembly name System, or one of its dependencies, was not found" error.. So what should i be running? can i just swicth over now to 1.1 and all will be fine and dandy? i do not want to have to go into the code and recompile. From the DNN 2.0 documentation i thought this would be the version for .Net 1.1 and that DNN 1.0 was for .Net 1.0 and therefore i should change over t...

Web resources about - System.Drawing Bug in Mono resolution. -

Display resolution - Wikipedia, the free encyclopedia
For screen sizes (typically in inches, measured on the diagonal), see Display size . For a list of particular display resolutions, see Graphic ...

UN Approves Resolution Urging Action Against ISIL - Al Jazeera America
Resolution sponsored by France urges states to take 'all necessary measures' to defeat ISIL

New Year's resolutions for those in IT
Ah, yes. Nothing like the crushing pressure of New Year’s resolutions to finally address everything we’ve been doing wrong for the past 12 months! ...

"After UW-Madison chancellor's email stirred controversy, Regents prepare resolution on free speech." ...
... on those who do not come from a cultural and family background where polite speech is the usual form of communication.) The proposed resolution ...

PPC New Year’s Resolutions: Power-up Your 2016 Paid Search, Display & Social Advertising Campaigns
PPC New Year’s Resolutions: Power-up Your 2016 Paid Search, Display & Social Advertising Campaigns was originally published on, ...

U.N. approves Security Council resolution to fight terror
France-sponsored resolution is unified message "to redouble and coordinate" programs to suppress terrorist acts by "all necessary measures"

New tech can boost smartphone resolution to 4K without hindering battery life
Software technology being developed in Japan is able to improve smartphone screen resolution to 4K while not drastically effecting battery life. ...

North Korea Tests Submarine Missile In Direct Violation Of UN Resolution
North Korea Tests Submarine Missile In Direct Violation Of UN Resolution

BOE 10.5G fab set to produce large-size, high-resolution panels in 2018
... on a 10.5G fab in February 2016 and finish in 2018. The fab will focus mainly on production of 65-inch and above-size TV panels with resolutions ...

Dive Onto Pluto's High-Resolution Landscape: Photos
Newly returned pictures taken by NASA’s New Horizons spacecraft are giving scientists and the rest of us the most detailed views of Pluto’s stunningly ...

Resources last updated: 12/13/2015 1:44:39 PM