ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Image Database
@ 2005-08-18 13:06 Jessica Holle
  2005-08-18 17:30 ` Willi Egger
  0 siblings, 1 reply; 3+ messages in thread
From: Jessica Holle @ 2005-08-18 13:06 UTC (permalink / raw)



I've some questions about the Image Database.
I found no answers in the xfigure.pdf.

Can I generate the xml file automaticly?
I can use xmltools --dir --pattern=/home/tralal/*.jpg
--output=tralala.xml
but then in the xml file doesn't stad figure, there is file. so this
doesn't work I think.

Must everything be in the same folder? the xmlfile, the images and
my document I'm writing?
Or can I specify a directory in the xmlfile? So that the images can
be on an other folder than the xmlfile?

Must the xmlfile be in the same directory than my document?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Image Database
  2005-08-18 13:06 Image Database Jessica Holle
@ 2005-08-18 17:30 ` Willi Egger
  2005-08-18 18:30   ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Willi Egger @ 2005-08-18 17:30 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1146 bytes --]



Jessica Holle wrote:
> I've some questions about the Image Database.
> I found no answers in the xfigure.pdf.
> 
> Can I generate the xml file automaticly?
> I can use xmltools --dir --pattern=/home/tralal/*.jpg
> --output=tralala.xml
> but then in the xml file doesn't stad figure, there is file. so this
> doesn't work I think.
> 
Humble, I do not know what xmltools all can do. I use a perl-sript to 
generate the xml-file. - Please have a look into the attached file 
make-xml.pl

> Must everything be in the same folder? the xmlfile, the images and
> my document I'm writing?
> Or can I specify a directory in the xmlfile? So that the images can
> be on an other folder than the xmlfile?
Normally I prepare a directory with the figures. The xml-file is then 
generated and compiled. The resulting figure-databse I transfer then to 
the directory where the tex files reside.


> 
> Must the xmlfile be in the same directory than my document?

I hope this will help you.
Kind regards

Willi
> 
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

[-- Attachment #2: make-xml.pl --]
[-- Type: text/plain, Size: 3816 bytes --]

#!/usr/bin/perl

## Prepare an XML-file for the preparation of a figure-database with TeX

## XML-file header information:

$Librarylanguage = "en";
$Organization = "Willi";
$Project = "Restauratie";
$Product = "Restauratie-cursus ";
$Comment = "Figure database";
$CopyRight = "WE" ;


## Variables

$Filename = "";
$FileextensionA = "pdf";
$FileextensionB = "png";
#~ $FileextensionC = "1";
$Filedate = "";
$Filetimestamp ;
$Filesize= "";
$Globstring = "*." . $FileextensionA;
$Outfile = ">Figure-lib.xml";

## Date
($Second, $Minute, $Hour, $DayOfMonth, $Month, $Year, $WeekDay, $DayOfYear, $IsDST) = localtime(time);
$RealMonth = $Month +1 ;
$RealYear  = $Year + 1900 ;

printf ('%02d.%02d.%04d', $DayOfMonth,$RealMonth,$RealYear);
print   "\n";

## Open the XML-file for writing:
open(OUTFILE, $Outfile);

## Print XML-file header:
Header();

## Collect Figure files into an list:

@Files = glob($Globstring);
$Globstring = "*." . $FileextensionB;
@MoreFiles = glob($Globstring);
push(@Files, @MoreFiles);
#~ $Globstring = "*." . $FileextensionC;
#~ @MoreFiles = glob($Globstring);
#~ push(@Files, @MoreFiles);

## Work on each filename:

foreach $Filename (@Files) {

    #~ $exifinfo = `identify -verbose -format "%[EXIF:*]" $Filename`;
    #~ chomp($exifinfo);
    #~ if(length($exifinfo) < 2){
        #~ $Filetimestamp = (-C $Filename) ;
        #~ $Filedatestamp = time - $Filetimestamp ;
        #~ ($Second, $Minute, $Hour, $DayOfMonth, $Month, $Year, $WeekDay, $DayOfYear, $IsDST) = localtime($Filedatestamp);
        #~ $RealMonth = $Month +1 ;
        #~ $RealYear  = $Year + 1900 ;
        #~ $FileDate = $DayOfMonth . "." . $RealMonth . "." . $RealYear ;
    #~ }
    #~ else {
        #~ @exiflines = split(/\n/,$exifinfo);
        #~ foreach $exifline (@exiflines){
        #~ ($exifHeader,$exifData) = split(/=/,$exifline,2);
        #~ if($exifHeader eq "DateTimeOriginal"){
            #~ $FileDate = substr($exifData,8,2) . "." . substr($exifData,5,2) . "." . substr($exifData,0,4);
        #~ }
        #~ }
    #~ }
    $Filesize = (-s $Filename) ;
    if ($Filesize > 1024){
        $Filesize = int($Filesize / 1024) . "k";
	}
## Determine first part	of filename -> label in figure library
($Label,$Suffix) = split (/\./,$Filename) ;

## Print the XMLblock for the actual figurefile:

Printfigureblock();
}

print OUTFILE  "</figurelibrary>";

close(OUTFILE);

## End of main programme.


sub Header{
    print OUTFILE "<!-- Figurelibrary: $Outfile -->\n" ;
    print OUTFILE "<!-- Date of generation:" ;
    printf OUTFILE ('%02d.%02d.%04d', $DayOfMonth,$RealMonth,$RealYear) ;
    print OUTFILE "-->\n" ;
    print OUTFILE "<!-- Figurelibrary generated automatically by PERL -->\n" ;
    print OUTFILE "<!-- Script by W. Egger, 27.04.2003 -->\n" ;
    print OUTFILE  "\n" ;
    print OUTFILE "<!-- Generation of a PDF file with the database: texexec --pdf --use=fig-make figure-lib.xml -->\n" ;
    print OUTFILE  "\n" ;
    print OUTFILE  "<figurelibrary language=\"$Librarylanguage\">\n" ;
    print OUTFILE  "\n" ;
    print OUTFILE  "   <description>\n" ;
    print OUTFILE  "       <organization>$Organization</organization>\n" ;
    print OUTFILE  "       <project>$Project</project>\n" ;
    print OUTFILE  "       <product>$Product</product>\n" ;
    print OUTFILE  "       <comment>$Comment</comment>\n" ;
    print OUTFILE  "   </description>\n" ;
    print OUTFILE  "\n" ;
}

sub Printfigureblock{
    print OUTFILE  "<figure>\n" ;
    print OUTFILE  "   <file>" . lc($Filename) . "</file>\n" ;
	print OUTFILE  "   <label>" .lc($Label). "</label>\n" ;
    print OUTFILE  "   <copyright>$CopyRight</copyright>\n" ;
    print OUTFILE  "   <comment>$FileDate " . $Filesize . "B</comment>\n" ;
    print OUTFILE  "</figure>\n\n" ;

    print "Finished figureblock: $Filename\n";
}

[-- Attachment #3: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Image Database
  2005-08-18 17:30 ` Willi Egger
@ 2005-08-18 18:30   ` Hans Hagen
  0 siblings, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2005-08-18 18:30 UTC (permalink / raw)


Willi Egger wrote:

>
>
> Jessica Holle wrote:
>
>> I've some questions about the Image Database.
>> I found no answers in the xfigure.pdf.
>>
>> Can I generate the xml file automaticly?
>> I can use xmltools --dir --pattern=/home/tralal/*.jpg
>> --output=tralala.xml
>> but then in the xml file doesn't stad figure, there is file. so this
>> doesn't work I think.
>>
> Humble, I do not know what xmltools all can do. I use a perl-sript to 
> generate the xml-file. - Please have a look into the attached file 
> make-xml.pl

if you install cont-exa.zip, you can say:

rslibtool --add *.pdf

(other options are --delete --sort etc; undocumented)

>
>> Must everything be in the same folder? the xmlfile, the images and
>> my document I'm writing?
>> Or can I specify a directory in the xmlfile? So that the images can
>> be on an other folder than the xmlfile?
>
> Normally I prepare a directory with the figures. The xml-file is then 
> generated and compiled. The resulting figure-databse I transfer then 
> to the directory where the tex files reside.

should be possible

>
>>
>> Must the xmlfile be in the same directory than my document?
>
no, you can define paths with 

\usepath[...]
\useeubpath[...]
\setupexternalfigures[directory=...]

support for figure databases will move to rlxtools; although not yet documented, context supports on the fly conversions with caching (so that it only happens when needed) based on resource logs 

more about that later 

Hans 


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-08-18 18:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-18 13:06 Image Database Jessica Holle
2005-08-18 17:30 ` Willi Egger
2005-08-18 18:30   ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).