Author Topic: Saving to MultiPage TIFF Firemonkey Mac Issue  (Read 4458 times)

Offline eddy2099

  • Imaging User
  • *
  • Posts: 4
    • View Profile
Saving to MultiPage TIFF Firemonkey Mac Issue
« on: 13 March 2013, 07:05:43 »
I am not sure if I am doing this correct

Code: Pascal
  1. procedure TForm2.Button1Click(Sender: TObject);
  2. var sm : TSingleImage;
  3. var mm : TMultiImage;
  4. var y,x : integer;
  5. var ss : string;
  6.  
  7. begin
  8. if OpenDialog1.execute then
  9.    begin
  10.  
  11.    y := opendialog1.Files.Count-1;
  12.    mm := TMultiImage.Create;
  13.  
  14.            sm := TSingleImage.Create;
  15.  
  16.    for x  := 0 to y do
  17.    begin
  18.    ss := IncludeTrailingBackslash(ExtractFilePath(opendialog1.Files.Strings[x]));
  19.       memo1.Lines.Add(opendialog1.Files.Strings[x]);
  20.      sm.LoadFromFile(opendialog1.Files.Strings[x]);
  21.  
  22.  
  23.  
  24.      if mm.ImageCount = 0 then
  25.        mm.Assign(sm)
  26.        else
  27.  
  28.         mm.AddImage(sm)     ;
  29.  
  30.  
  31.  
  32.  
  33.    end;
  34.  
  35.      mm.SaveMultiToFile(ss+'vampyre.tif');
  36.  
  37.  if mm.AllImagesValid  then
  38.          label1.Text := 'Good'
  39.          else
  40.          label2.text := 'Bad';
  41.  
  42.    end;
  43.  
  44. end;

I tested the above codes in Windows, it worked fine as the MultiPage TIFF is saved. However, deploying to the Mac, the AllImagesValid shows as True but then nothing is saved.

Is there anything I might be doing wrong ?

Thanks in advance

**Update** I changed the filename from TIFF to a JPG name and it worked on the Mac. I think the LibTIFF library doesn't seems to work with the Mac as it wasn't ported over. Perhaps that was the issue. Any solution ?

Overall, a very nice library. Would be perfect if the TIFF module works on the Mac.
« Last Edit: 13 March 2013, 13:03:12 by eddy2099 »

Mauricio

  • Guest
Re: Saving to MultiPage TIFF Firemonkey Mac Issue
« Reply #1 on: 25 March 2013, 17:30:56 »
Hi,

i' m currently trying to use Vampyre with FireMonkey:
i noticed that i lost resolution information doing this:

procedure TForm3.Button1Click(Sender: TObject);
var MultiImage: TMultiImage;
begin
  MultiImage := TMultiImage.Create;
  MultiImage.LoadMultiFromFile('d:\_temp\x1.tif');  // 300 dpis tif ...

  MultiImage.SaveMultiToFile('d:\_temp\Vampyre.tif');
  MultiImage.Free;
end;

Vampyre.tif have 72 dpis instead of 300 dpis like the original. Any idea?

Regards,
Mauricio

Mauricio

  • Guest
Re: Saving to MultiPage TIFF Firemonkey Mac Issue
« Reply #2 on: 25 March 2013, 18:54:37 »
Hi,

found solution here:
http://galfar.vevb.net/imaging/smf/index.php/topic,757.msg1409.html#msg1409

Entire code:
var
  MultiImage: TMultiImage;
  XRes, YRes: Single;
  ResUnit: TResolutionUnit;
begin
  MultiImage := TMultiImage.Create;
  MultiImage.LoadMultiFromFile('d:\_temp\x1.tif');

  // After load image :
  ResUnit := ruDpi;
  if GlobalMetadata.GetPhysicalPixelSize(ResUnit, XRes, YRes) then

//  MultiImage.ExchangeImages(0, 1);
  // MultiImage.DeleteImage(1);

  // Before saving :
  GlobalMetadata.SetPhysicalPixelSize(ResUnit, XRes, YRes, True);
  MultiImage.SaveMultiToFile('d:\_temp\Vampyre.tif');
  MultiImage.Free;
end;

Regards,
Mauricio


PS: i will try this on mac OSX soon!

Mauricio

  • Guest
Re: Saving to MultiPage TIFF Firemonkey Mac Issue
« Reply #3 on: 26 March 2013, 10:21:31 »
Hi eddy2099,

i have tryied my previous code on mac OSX and it  can' t load image.

Do you have succes using Vampyre library on mac OSX?

Mauricio

Offline eddy2099

  • Imaging User
  • *
  • Posts: 4
    • View Profile
Re: Saving to MultiPage TIFF Firemonkey Mac Issue
« Reply #4 on: 2 April 2013, 14:33:12 »
No, I was not able to. I believe there is no support for Multipage TIFF for Mac from this library.

Offline jus

  • Imaging User
  • *
  • Posts: 7
    • View Profile
Re: Saving to MultiPage TIFF Firemonkey Mac Issue
« Reply #5 on: 3 April 2013, 01:12:13 »
As I know so far vampyre can't deal with tif in generally in mac. I think the problems is the lack of compiled binary object files of libtiff, because vampyre used libtiff to read and write tiff files. I'm using Lazarus for Mac and my workaround is just download a fully compiled libtiff.dylib library like from fink and use the libtiff dylib library directly to load tiff files. After the tiff files is loaded you can directly pass the rgb data directly to vampyre for further image processing. In your case you just need to implement the part of the libtiff library functions for saving the tiff file. The only good thing, which functions you need from the libtiff library, is that you can directly look at the sources of vampyre library how vampyre did it in windows. That's maybe a way to go. Just give us a feedback how you have made it.   :)

jus

Offline eddy2099

  • Imaging User
  • *
  • Posts: 4
    • View Profile
Re: Saving to MultiPage TIFF Firemonkey Mac Issue
« Reply #6 on: 3 April 2013, 02:24:41 »
Thanks. I could explore that avenue. Currently, I am saving single page TIFF using firemonkey native routine and then using tiffutil in command line to merge them together. Not the best solution but it does work in my initial test.

Offline eddy2099

  • Imaging User
  • *
  • Posts: 4
    • View Profile
Re: Saving to MultiPage TIFF Firemonkey Mac Issue
« Reply #7 on: 3 April 2013, 08:23:08 »
In fact, I found that the MultiPages Support for Firemonkey 64 Bit is also not working. It is clearly an issue with getting the TIFFLib to work.

I did try to compile the TIFFLib for Mac but pretty much got lost in the compilation, I need to just dump the dylib in the bundle and use it anyway. Not very familiar with all those compilation of source codes but I will see what I can do.

Thanks.

Offline jus

  • Imaging User
  • *
  • Posts: 7
    • View Profile
Re: Saving to MultiPage TIFF Firemonkey Mac Issue
« Reply #8 on: 3 April 2013, 08:35:59 »
In mac I couldn't directly compile libtiff sources. So install fink in the command line first an then just download the fink libtiff Package und install it in the command line. The fink did the compilation for me. So at the end there is a libtiff.dylib and a libtiff.a file in the directory. Just give us a feedback when this works for you.
« Last Edit: 3 April 2013, 08:45:30 by jus »

Mauricio

  • Guest
Re: Saving to MultiPage TIFF Firemonkey Mac Issue
« Reply #9 on: 9 April 2013, 11:11:05 »
Hi,

i' m also not familiar with all of this.

Some developpers have tryied to compile LibTIFF for mac:
http://galfar.vevb.net/imaging/smf/index.php/topic,273.0.html

With Delphi XE3 and using fireMonkey, we compile on Windows and we debug the application on mac.
So, if source is cross-platform ready, all we have to do is compile our application.

The truth is i don' t know nothing about *.obj files and compiling with another tools but i think that some adustments in LibTIFF source are needed.
If the problem is *.obj files, we need another folder with this files ready for mac.

I am wrong?

Thanks,

Mauricio
http://sourceforge.net/projects/tcycomponents/

Offline Galfar

  • Administrator
  • Imaging User
  • *****
  • Posts: 354
    • View Profile
    • Galfar's Homepage
Re: Saving to MultiPage TIFF Firemonkey Mac Issue
« Reply #10 on: 3 March 2014, 17:45:29 »
I've been working on TIFF loader/saver for Imaging that won't need LibTiff as compiled objects
so in few weeks there will be TIFF support on more platforms (and LibTiff only as an option).