I tried your code and it worked for me.  After the call to your Load
function I used
        Image1.Canvas.MoveTo( 0, 0);
        Image1.Canvas.LineTo( Image1.Width-1, Image1.Height-1);
and got a diagonal black line across the image.

David
 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Bobby Clarke
Sent: Thursday, June 30, 2005 11:54 AM
To: [email protected]
Subject: RE: [delphi-en] jpg to bmp conversion is incomplete

Mike


I tried to draw on the bitmap rather than the Image1.Canvas and it
didn't error. It also did not show on screen!

I don't think that this is the answer because the program,. including
drawing, works if a bmp is read and fails if a jpg is read and
converted. It just has to be the method of conversion from jpg to bmp.
If the conversion is external (Photoshop) then program works.

Any other thoughts would be appreciated - I don't have much hair left to
pull out!


Bobby Clarke

  -----Original Message-----
  From: [email protected] [mailto:[EMAIL PROTECTED]
Behalf Of Mike Shkolnik
  Sent: 30 June 2005 11:56
  To: [email protected]
  Subject: Re: [delphi-en] jpg to bmp conversion is incomplete


  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

    a..  Visit your group "delphi-en" on the web.

    b..  To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

    c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.


------------------------------------------------------------------------
----
--




[Non-text portions of this message have been removed]



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
Yahoo! Groups Links



 



-----------------------------------------------------
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/
 


Reply via email to