среда, 4 августа 2010 г.

First results of test - png

Old PngEndAnalyzer:

./2.png
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentSize
"145620";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#isPartOf
"";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#lastModified
"1278429356";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType
"image/png",
"image/png";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url
"./2.png";
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#colorDepth
"32";
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName
"2.png";
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#height
"415";
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#interlaceMode
"None";
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#width
"800";
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
"http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#RasterImage",
"http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject".


Generated PngEndAnalyzer by Translator:

./2.png
http://freedesktop.org/standards/xesam/1.0/core#compressionAlgorithm
"6";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentSize
"145620";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#isPartOf
"";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#lastModified
"1278429356";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType
"image/png",
"image/png";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url
"./2.png";
http://www.semanticdesktop.org/ontologies/2007/03/22/nco#creator
":nwlrb";
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#colorDepth
"32";
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName
"2.png";
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#height
"415";
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#interlaceMode
"0";
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#width
"800";
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
"http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#RasterImage",
"http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject".
:nwlrb
http://www.semanticdesktop.org/ontologies/2007/03/22/nco#fullname
"";
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
"http://www.semanticdesktop.org/ontologies/2007/03/22/nco#Contact".


Extractor test:
myvector stores 7 numbers.
Name=Width Value = 800
Name=Height Value = 415
Name=Color_type Value = 8
Name=Compression_method Value = 6
Name=ColorDept Value = 32
Name=Filter_method Value = 0
Name=Interlace_method Value = 0


TFL input file:

Format Png;

Metadata: PngChunk;


if(PngChunk)
{
Width = "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#width";
Height = "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#height";
ColorDepth= "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#colorDepth";
Compression_method = "http://freedesktop.org/standards/xesam/1.0/core#compressionAlgorithm";
Interlace_method = "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#interlaceMode";
Title="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title";
Author="http://www.semanticdesktop.org/ontologies/2007/03/22/nco#creator";
Description="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#description";
Copyright="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#copyright";
Creation_time="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentCreated";
Software="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#generator";
Dislaimer="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#disclaimer";
Warning="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#comment";
Source="http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#model";
Comment="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#comment";

&type="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
&fullname="http://www.semanticdesktop.org/ontologies/2007/03/22/nco#fullname";
&contactClass= "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#Contact";
&rasterImage = "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#RasterImage";
Uri a;
T: a - type - contactClass;
T: a - fullname - Author;

D: type - rasterImage;

}


TL input file:

Binary PngChunk;

ByteOrder=MSB;
BitOrder=MSB;

StartMetadataKey MagicHex(offset=0, size=8);
checkKey(MagicHex)=0x89504e470d0a1a0a;

MetadataKey length(MagicHex, offset=0, size=4);
MetadataKey chunkname(length, offset=0, size=4);
MetadataKey data(chunkname, offset=0, size=getNumber(length));
MetadataKey crc(data, offset=0, size=4);

while(getValue(chunkname)!="IEND")
{
if(getValue(chunkname)=="IHDR")
{

MetadataKey width(chunkname, offset=0, size=4);
SetTag Width(getNumber(width));

MetadataKey height(width, offset=0, size=4);
SetTag Height(getNumber(height));

MetadataKey ColorType(height, offset=0, size=1);
SetTag Color_type(getNumber(ColorType));

MetadataKey Compression(ColorType, offset=0, size=1);
SetTag Compression_method(getNumber(Compression));

if(getNumber(Compression)==2)
{
n=3*getNumber(ColorType);
SetTag ColorDepth(n);
}

if(getNumber(Compression)==4)
{
n=2*getNumber(ColorType);
SetTag ColorDepth(n);
}

if(getNumber(Compression)==6)
{
n=4*getNumber(ColorType);
SetTag ColorDepth(n);
}

MetadataKey Filter(Compression, offset=0, size=1);
SetTag Filter_method(getNumber(Filter));

MetadataKey Interlace(Filter, offset=0, size=1);
SetTag Interlace_method(getNumber(Interlace));

}

if(getValue(chunkname)=="tEXt")
{
keyword=getStringByLink(chunkname,offset=0);
n=getLength(keyword);
datatext=getStringByLink(chunkname,offset=n+1);
if(keyword=="Title") SetTag Title(datatext);
if(keyword=="Author") SetTag Author(datatext);
if(keyword=="Description") SetTag Description(datatext);
if(keyword=="Copyright") SetTag Copyright(datatext);
if(keyword=="Creation Time") SetTag Creation_time(datatext);
if(keyword=="Software") SetTag Software(datatext);
if(keyword=="Disclaimer") SetTag Disclaimer(datatext);
if(keyword=="Warning") SetTag Warning(datatext);
if(keyword=="Source") SetTag Source(datatext);
if(keyword=="Comment") SetTag Comment(datatext);

}

oldlength=getNumber(length);
shift(length, 8+oldlength);
newlength=getNumber(length);
shift(chunkname, 8+oldlength);
shift(data, 12);
shift(crc, 8+newlength);

}

Комментариев нет:

Отправить комментарий