Initial Problem

I could draw on an Image loaded with a bit map if I read it in a bitmap but
not if I read as jpeg and converted to bmp. I could draw on bmp converted
by, say, Photoshop.


Group Suggestions

David Smith proved that my code worked on his computer and even tested a
jpeg for me. This was a crucial test as it proved that my code work on other
computers.

Mike suggested that I could draw always on the BMP and copy to the Image.
This worked for a while and then stopped.


Current Position

As a result of Group help, I stopped staring at my code and looked at the
hardware event log. I am now off to buy a new disc / controller or probably
a new computer.


Moral?

Trust your own code sometimes! Be more ready to blame Bill Gates, Intel or
indeed, anyone else!



Thanks to everyone for their help. I now realize that this whole problem was
hardware and therefore off-topic!



Bobby Clarke








  -----Original Message-----
  From: [email protected] [mailto:[EMAIL PROTECTED]
Behalf Of Smith David G (Finance)
  Sent: 30 June 2005 18:28
  To: [email protected]
  Subject: RE: [delphi-en] jpg to bmp conversion is incomplete


  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

    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

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