ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 IPTC information in tiff-files
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

arkipix

Denmark
16 Posts

Posted - May 03 2012 :  01:37:20  Show Profile  Reply
ImageEnIO1.Params.TIFF_DocumentName:='ArkiPix';
ImageEnIO1.Params.TIFF_ImageDescription:= RichEdit1.Text;
ImageEnIO1.SaveToFile(imagename);

This do not work. No information in the image.
Why?
Works fine in PhotoShop.
Regards
Peter

fab

1310 Posts

Posted - May 03 2012 :  03:39:05  Show Profile  Reply
Please add details:
1) has the "imagename" TIFF extension?
2) how do you test if the information is inside the file?
Go to Top of Page

arkipix

Denmark
16 Posts

Posted - May 06 2012 :  04:54:29  Show Profile  Reply
Hi Fabrizio
I test like this:
if (Uppercase(ExtractFileExt(BilledNavn)) = '.TIF') or (Uppercase(ExtractFileExt(BilledNavn)) = '.TIFF') then

I read like this (from PhotoShop too)
ImageEnIO1.ParamsFromFile(Billednavn);
for i:=0 to high(iptc) do
Begin
with ImageEnIO1.Params.IPTC_Info do
StringGrid1.Cells[1,i+1]:= StringItem[ IndexOf(iptc [i].r,iptc[i].d) ];
if I=2 then StringGrid1.Cells[1,i+1] := KeyDybere;
End;


10.53 KB
I hope this explains my problem
Regards
Peter
Go to Top of Page

fab

1310 Posts

Posted - May 06 2012 :  05:13:24  Show Profile  Reply
Hi Peter,
what I don't understand is why you set TIFF parameters and read IPTC tags?
You should set IPTC parameters using Params.IPTC_Info.AddStringItem().
Go to Top of Page

arkipix

Denmark
16 Posts

Posted - May 06 2012 :  05:33:09  Show Profile  Reply
Sorry Fabrizio
It works fine now.
I don't know what PhotoShop does, but this is what i wanted.
Thanks
Peter
Go to Top of Page

arkipix

Denmark
16 Posts

Posted - May 14 2012 :  01:41:30  Show Profile  Reply
Sorry Fabizio.
What is wrong?
When I put caption in more than one image it copies all image information and the first image to all marked images. Then they are all alike!!
Caption is written OK.
if (Uppercase(ExtractFileExt(BilledNavn)) = '.TIF') or (Uppercase(ExtractFileExt(BilledNavn)) = '.TIFF') then
begin
// ImageEnIO1.LoadFromFileTIFF(Billednavn);
//ImageEnIO1.ParamsFromFile(BilledNavn);
ImageEnIO1.Params.IPTC_Info.AddStringItem(2,120,RichEdit1.Text) ;
ImageEnIO1.SaveToFile(Billednavn);
end else fejl(44);(This code is repeated for each image)
Regards
Peter
Go to Top of Page

fab

1310 Posts

Posted - May 14 2012 :  01:56:27  Show Profile  Reply
I don't see, in your code, how you load the image (both LoadFromFileTIFF and ParamsFromFile are commented out). If you want to reset I/O parameters you have to ways:
1) call ParamsFromFile or LoadFromFile...
2) call ImageEnIO1.Params.SetDefaultParams()
Go to Top of Page

arkipix

Denmark
16 Posts

Posted - May 14 2012 :  02:49:11  Show Profile  Reply
Hi
They are not used because they did not make any difference.
If I select only one image and save it, is OK with the next image.
All works fine with jpegs.

Procedure is:

for I := 0 to ImageEnMView1.MultiSelectedImagesCount - 1 do
begin
selected := ImageEnMView1.MultiSelectedImages[I];
BilledNavn := ImageEnMView1.ImageFileName[selected];
GemBtnClick(Sender);<-Call to the next procedure that saves the caption.
end;

If (Uppercase(ExtractFileExt(BilledNavn)) = '.JPG') or (Uppercase(ExtractFileExt(BilledNavn)) = '.JPEG') then
Begin
.................
End
else if (Uppercase(ExtractFileExt(BilledNavn)) = '.TIF') or (Uppercase(ExtractFileExt(BilledNavn)) = '.TIFF') then

Regards
Peter
Go to Top of Page

fab

1310 Posts

Posted - May 14 2012 :  02:56:35  Show Profile  Reply
Hi,
you never told about a TImageEnMView...
I suppose you want to extract each image in TImageEnMView to an external file, right?
In this case you could just execute GetImageToFile:

ImageEnMView1.MIO.Params[imageIndex].IPTC_Info.AddStringItem(2,120,RichEdit1.Text) ;
ImageEnMView1.GetImageToFile(imageIndex, 'out,jpg');
Go to Top of Page

arkipix

Denmark
16 Posts

Posted - May 14 2012 :  03:52:16  Show Profile  Reply
Hi again.
My program is an archiving program.
Thumbs are shown in ImageEnMView1.
You mark them ( one or more) write the keyword (IPTC-caption) and save it in the image.
A database is updated and you can find the wanted image in fractions of a second.
It has always been jpegs, but I want to use it on tiff images too. It is no problem inserting keywords in IPTC-caption with PhotoShop and imageen can read from these tiff images (and from the XMP too).
As i see it now it is not so easy as I thought with ImageEn.
Should it be easy I am very interested.
Regards
Peter
Go to Top of Page

arkipix

Denmark
16 Posts

Posted - May 16 2012 :  03:52:36  Show Profile  Reply
Hi
When I use your sample program iptc.dpr with the small change, that it repeat inserting iptc information in two or three images. IPTC is inserted, but on reload the images are all showing the same picture.
Why?
What I need is a kind of InjectTiffIPTC or some reset efter each image.
Am I doing it wrong?
Regards
Peter
Go to Top of Page

fab

1310 Posts

Posted - May 16 2012 :  06:07:20  Show Profile  Reply
Hi,
IPTC sample works ok, even loading and saving different images and storing the same IPTC info.
Go to Top of Page

arkipix

Denmark
16 Posts

Posted - May 23 2012 :  00:39:56  Show Profile  Reply
Hi again
I do not understand.
What is wrong with this (erasing captions)
procedure TMain.SletBtnClick(Sender: TObject);
Var I, idx: Integer;
begin //
If ImageEnMView1.MultiSelectedImagesCount > 1 then
Begin
Fortrydsletning1.Enabled := False;//Undo
Fortrydsletning2.Enabled := False;
CapFrm.UndoBtn.Enabled := False;
for I := 0 to ImageEnMView1.MultiSelectedImagesCount - 1 do
begin
ImageEnIO1.ParamsFromFile(ImageEnMView1.ImageFileName[ImageEnMView1.MultiSelectedImages[I]]);
idx := ImageEnIO1.params.IPTC_Info.IndexOf(2, 120);
If idx > -1 then
Begin //
ImageEnIO1.params.IPTC_Info.StringItem[idx] := ''; //
case ImageEnIO1.Params.FileType of
ioJPEG: If ImageEnIO1.InjectJpegIPTC(ImageEnMView1.ImageFileName[ImageEnMView1.MultiSelectedImages[I]])= False then
fejl(38); //
ioTIFF: if ImageEnIO1.SaveToFileTIFF(ImageEnMView1.ImageFileName[ImageEnMView1.MultiSelectedImages[I]]) = False then
fejl(38); //error ;
end; //case
end;
end;
end
end;
I erase the caption, but the images with the same motive.
Regards
Peter
Go to Top of Page

arkipix

Denmark
16 Posts

Posted - May 23 2012 :  00:45:34  Show Profile  Reply
Sorry
this is the line:
ioTIFF: ImageEnIO1.SaveToFileTIFF(ImageEnMView1.ImageFileName[ImageEnMView1.MultiSelectedImages[I]]); // ;
Gives all the images the same motive.
Regarsd
Peter
Go to Top of Page

fab

1310 Posts

Posted - May 23 2012 :  01:03:19  Show Profile  Reply
ImageEnIO1 is connected to?

Anyway if TImageEnMView contains full images (not thumbnails) you can write:
// note: I removed ioJPEG code, because it works, just to make code more clear
for I := 0 to ImageEnMView1.MultiSelectedImagesCount - 1 do
begin
  with ImageEnMView1.MIO.Params[ ImageEnMView1.MultiSelectedImages[I] ] do
  begin
    idx := IPTC_Info.IndexOf(2, 120);
    If idx > -1 then
       IPTC_Info.StringItem[idx] := '....';
  end;
  with ImageEnMView1 do
    GetImageToFile(MultiSelectedImages[I], ImageFileName[MultiSelectedImages[I]]);
end;


Another way:
var ie: TImageEnView;
...
ie := TImageEnView.Create(nil);
for i:=0 to ImageEnMView1.MultiSelectedImagesCount-1 do
begin
  filename := ImageEnMView1.ImageFileName[ ImageEnMView1.MultiSelectedImages[I] ];
  ie.IO.LoadFromFile(filename);
  ie.IO.Params.IPTC.... do something with IPTC...
  ie.IO.SaveToFile(filename);
end;
ie.Free();

Otherwise, if ImageEnIO1 is connected to TImageEnMView, then it points to currently selected image. This is because you get always the same image.

Go to Top of Page

arkipix

Denmark
16 Posts

Posted - May 23 2012 :  04:00:47  Show Profile  Reply
Hi Fabrizio
Sorry for my bad explanations.
Now it all works fine.
I ended up with this:
for Z := 0 to ImageEnMView1.MultiSelectedImagesCount - 1 do
begin
ImageEnIO1.ParamsFromFile(ImageEnMView1.ImageFileName[ImageEnMView1.MultiSelectedImages[Z]]);
Case ImageEnIO1.Params.FileType of
ioJpeg:
begin //Hvis jpeg
with ImageEnMView1.MIO.Params[ImageEnMView1.MultiSelectedImages[Z]] do
Begin
idx := IPTC_Info.IndexOf(2, 120);
If idx > -1 then IPTC_Info.StringItem[idx] := ''; //
end;
If ImageEnIO1.InjectJpegIPTC(ImageEnMView1.ImageFileName[ImageEnMView1.MultiSelectedImages[Z]])= False then
fejl(38); //
end;
ioTiff:
Begin //Hvis TIFF
ie := TImageEnView.Create(nil);
billednavn := ImageEnMView1.ImageFileName[ImageEnMView1.MultiSelectedImages[Z]];
ie.IO.LoadFromFile(billednavn);
idx := ImageEnMView1.MIO.Params[ImageEnMView1.MultiSelectedImages[Z]].IPTC_Info.IndexOf(2, 120);
ie.IO.Params.IPTC_Info.StringItem[idx] := '';
ie.IO.SaveToFile(billednavn);
ie.Free();
End;
end; //case
end;

Thankyou
Regards
Peter
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: