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

Saving to MultiPage TIFF Firemonkey Mac Issue

Started by eddy2099, 13 March 2013, 07:05:43

Previous topic - Next topic

eddy2099

13 March 2013, 07:05:43 Last Edit: 13 March 2013, 13:03:12 by eddy2099
I am not sure if I am doing this correct

Code (pascal) Select
procedure TForm2.Button1Click(Sender: TObject);
var sm : TSingleImage;
var mm : TMultiImage;
var y,x : integer;
var ss : string;

begin
if OpenDialog1.execute then
   begin

   y := opendialog1.Files.Count-1;
   mm := TMultiImage.Create;

           sm := TSingleImage.Create;

   for x  := 0 to y do
   begin
   ss := IncludeTrailingBackslash(ExtractFilePath(opendialog1.Files.Strings[x]));
      memo1.Lines.Add(opendialog1.Files.Strings[x]);
     sm.LoadFromFile(opendialog1.Files.Strings[x]);



     if mm.ImageCount = 0 then
       mm.Assign(sm)
       else

        mm.AddImage(sm)     ;




   end;

     mm.SaveMultiToFile(ss+'vampyre.tif');

if mm.AllImagesValid  then
         label1.Text := 'Good'
         else
         label2.text := 'Bad';

   end;

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.

Mauricio

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

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

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

eddy2099

No, I was not able to. I believe there is no support for Multipage TIFF for Mac from this library.

jus

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

eddy2099

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.

eddy2099

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.

jus

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.

Mauricio

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/

Galfar

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

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