Vampyre Imaging Library Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Imaging 0.26.4 Released!

Author Topic: Convert jpeg200 to jpeg  (Read 890 times)

bunak

  • Guest
Convert jpeg200 to jpeg
« on: 31 August 2009, 19:48:43 »

Hi, all
which function and how i need use it for convert image from jpeg2000 to jpeg. ???
Thanks
Logged

Galfar

  • Administrator
  • Imaging User
  • *****
  • Offline Offline
  • Posts: 249
    • ICQ Messenger - 327174200
    • View Profile
    • Galfar's Homepage
    • Email
Re: Convert jpeg200 to jpeg
« Reply #1 on: 31 August 2009, 21:49:38 »

Just load the file and save it in another format:

Code: [Select]
uses
  ImagingClasses;
var
  Img: TSingleImage;
begin
  Img := TSingleImage.Create;
  Img.LoadFromFile('myjpeg2k.jp2');
  Img.SaveToFile('myjpeg.jpg');
....
Logged

bunak

  • Guest
Re: Convert jpeg200 to jpeg
« Reply #2 on: 1 September 2009, 12:25:37 »

Thank you
Logged

bunak

  • Guest
Re: Convert jpeg200 to jpeg
« Reply #3 on: 2 September 2009, 12:17:29 »

I need convert jpeg2000 for a blob field. After converted the image, it need save to file. And I do it like this

Code: [Select]
// if field need to convert
if qr.FieldByName('ext').AsString = 'jp2'
then
  begin
    Img := TSingleImage.Create;
    mem_st := TMemoryStream.Create;

    // convert
    try
        TBlobField(qr.FieldByName('img')).SaveToStream(mem_st);
        mem_st.Position := 0;
        Img.LoadFromStream(mem_st);
        str_file_path := qr.FieldByName('img_name').AsString + '.jpg';
        Img.SaveToFile(str_file_path);
    finally
        mem_st.Free;
        Img.Free;
    end;
  end

In result - image is a black square.
Help me please.
Logged

bunak

  • Guest
Re: Convert jpeg200 to jpeg
« Reply #4 on: 2 September 2009, 12:58:41 »

Just load the file and save it in another format:

Code: [Select]
uses
  ImagingClasses;
var
  Img: TSingleImage;
begin
  Img := TSingleImage.Create;
  Img.LoadFromFile('myjpeg2k.jp2');
  Img.SaveToFile('myjpeg.jpg');
....

I am also tried convert image by this method. And in result also get the black square in jpeg-file.

My be this is because I disable unit ImagingExtras in Imaging unit. I do it because Delphi 7 can not find ImagingExtras.dcu file. ??? And i realy can not find a ImagingExtras files in 0.26.2 package, that was uploaded from hear !!
Logged

bunak

  • Guest
Re: Convert jpeg200 to jpeg
« Reply #5 on: 2 September 2009, 13:10:09 »

Sorry.
I find ImagingExtras.pas and all work correctly.

Thanks
Logged
 

Page created in 0.081 seconds with 20 queries.