• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

Convert jpeg200 to jpeg

Started by bunak, 31 August 2009, 19:48:43

Previous topic - Next topic

bunak

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

Galfar

Just load the file and save it in another format:


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


bunak

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

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

bunak

Quote from: Galfar on 31 August 2009, 21:49:38
Just load the file and save it in another format:


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

bunak

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

Thanks

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Name:
Email:

Shortcuts: ALT+S save/post or ALT+P preview

SMF spam blocked by CleanTalk