Bobby, you must draw on Bitmap.Canvas, not on Image1.Canvas
With best regards, Mike Shkolnik EMail: [EMAIL PROTECTED] http://www.scalabium.com --- Bobby Clarke <[EMAIL PROTECTED]> wrote: > I am having bmp/jpg problems. If an image is a bmp I > load it into Image1 and > I can draw on it without problems. > > If it is a jpeg, I convert to bmp either with Assign > or SaveToFile / > LoadFromFile as in the sample code. In both cases > when I try to draw on the > Image1.Canvas I get an error: Cannot modify image > unless it contains a > bitmap. > > If I open the jpeg in Photoshop and save as a > bitmap, then my code works > perfectly. I can even open my temporary file in > Adobe and overwrite with > SaveAs and the code works. > > What is Photoshop doing to the bitmap that my Delphi > code is not doing? > > > Bobby Clarke > > > > > Globally: > var > bmp : TBitMap > > bmp := TBitMap.Create; > > > > procedure Load(s:string); // s is a file name > var > sExt : string; > jpg : TJpegImage; > begin > sExt := lowercase(ExtractFileExt(s)); > if sExt = '.bmp' then > Image1.Picture.LoadFromFile(s) > else // it has to be jpeg > - tested elsewhere > begin > jpg := TJPegImage.Create; > try > jpg.LoadFromFile(s); > bmp.Assign(jpg); > > bmp.SaveToFile('c:\temp.bmp'); > Image1.Picture.LoadFromFile('c:\temp.bmp'); > // was > Image1.Picture.Bitmap.Assign(jpg); > > finally > jpg.Free; > end; > end; > end; ____________________________________________________ Yahoo! Sports Rekindle the Rivalries. Sign up for Fantasy Football http://football.fantasysports.yahoo.com ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

