c# free pdf viewer component : Add page to existing pdf file software Library dll winforms .net azure web forms REC-png1-part862

3. FILESTRUCTURE
11
137 80 78 71 1 13 10 0 26 10
ThissignatureindicatesthattheremainderofthefilecontainsasinglePNGimage,consistingofaseriesof
chunksbeginningwithanIHDRchunkandendingwithanIENDchunk.
SeeRationale:PNGfilesignature(Section12.11).
3.2 Chunklayout
Eachchunkconsistsoffourparts:
Length
A4-byteunsignedintegergivingthenumberofbytesinthechunk’sdatafield.Thelengthcountsonly
thedatafield,notitself,thechunktypecode,ortheCRC.Zeroisavalidlength. Althoughencoders
anddecodersshouldtreatthelengthasunsigned,itsvaluemustnotexceed(2ˆ31)-1bytes.
ChunkType
A4-bytechunktypecode. ForconvenienceindescriptionandinexaminingPNGfiles,typecodes
arerestrictedtoconsistofuppercaseandlowercaseASCIIletters(A-Zanda-z,or65-90and97-122
decimal).However,encodersanddecodersmusttreatthecodesasfixedbinaryvalues,notcharacter
strings.Forexample,itwouldnotbecorrecttorepresentthetypecodeIDATbytheEBCDICequiva-
lentsofthoseletters.Additionalnamingconventionsforchunktypesarediscussedinthenextsection.
ChunkData
Thedatabytesappropriatetothechunktype,ifany.Thisfieldcanbeofzerolength.
CRC
A4-byteCRC(CyclicRedundancyCheck)calculatedontheprecedingbytesinthechunk,includ-
ingthechunktypecodeandchunkdatafields,butnotincludingthelengthfield.TheCRCisalways
present,evenforchunkscontainingnodata.SeeCRCalgorithm(Section3.4).
Thechunkdatalengthcanbeanynumberofbytesuptothemaximum;therefore,implementorscannotas-
sumethatchunksarealignedonanyboundarieslargerthanbytes.
Chunkscanappearinanyorder,subjecttotherestrictionsplacedoneachchunktype.(Onenotablerestriction
isthatIHDRmustappearfirstandIENDmustappearlast;thustheIENDchunkservesasanend-of-file
marker.)Multiplechunksofthesametypecanappear,butonlyifspecificallypermittedforthattype.
SeeRationale:Chunklayout(Section12.12).
3.3 Chunknamingconventions
Chunktypecodesareassignedsothatadecodercandeterminesomepropertiesofachunkevenwhenitdoes
notrecognizethetypecode. Theserulesareintendedtoallowsafe,flexibleextensionofthePNGformat,
Add page to existing pdf file - insert pages into PDF file in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Guide C# Users to Insert (Empty) PDF Page or Pages from a Supported File Format
add page numbers to pdf document; adding a page to a pdf file
Add page to existing pdf file - VB.NET PDF Page Insert Library: insert pages into PDF file in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Easy to Use VB.NET APIs to Add a New Blank Page to PDF Document
adding page numbers in pdf file; add pages to an existing pdf
12
PNG(PORTABLENETWORKGRAPHICS)SPECIFICATION
byallowingadecodertodecidewhattodowhenitencountersanunknownchunk.Thenamingrulesarenot
normallyofinterestwhenthedecoderdoesrecognizethechunk’stype.
Fourbitsofthetypecode,namelybit5(value32)ofeachbyte,areusedtoconveychunkproperties. This
choicemeansthatahumancanreadofftheassignedpropertiesaccordingtowhethereachletterofthetype
codeisuppercase(bit5is0)orlowercase(bit5is1).However,decodersshouldtestthepropertiesofanun-
knownchunkbynumericallytestingthespecifiedbits;testingwhetheracharacterisuppercaseorlowercase
isinefficient,andevenincorrectifalocale-specificcasedefinitionisused.
Itisworthnotingthatthepropertybitsareaninherentpartofthechunkname,andhencearefixedforany
chunktype.Thus,TEXTandTextwouldbeunrelatedchunktypecodes,notthesamechunkwithdifferent
properties. Decodersmustrecognizetypecodesbyasimplefour-byteliteralcomparison;itisincorrectto
performcaseconversionontypecodes.
Thesemanticsofthepropertybitsare:
Ancillarybit:bit5offirstbyte
0(uppercase)=critical,1(lowercase)=ancillary.
Chunksthatarenotstrictlynecessaryinordertomeaningfullydisplaythecontentsofthefileareknown
as“ancillary”chunks.Adecoderencounteringanunknownchunkinwhichtheancillarybitis1can
safelyignorethechunkandproceedtodisplaytheimage. Thetimechunk(tIME)isanexampleof
anancillarychunk.
Chunksthatarenecessaryforsuccessfuldisplayofthefile’scontentsarecalled“critical”chunks. A
decoderencounteringanunknownchunkinwhichtheancillarybitis0mustindicatetotheuserthatthe
imagecontainsinformationitcannotsafelyinterpret.Theimageheaderchunk(IHDR)isanexample
ofacriticalchunk.
Privatebit:bit5ofsecondbyte
0(uppercase)=public,1(lowercase)=private.
ApublicchunkisonethatispartofthePNGspecificationorisregisteredinthelistofPNGspecial-
purposepublicchunktypes.Applicationscanalsodefineprivate(unregistered)chunksfortheirown
purposes.Thenamesofprivatechunksmusthavealowercasesecondletter,whilepublicchunkswill
alwaysbeassignednameswithuppercasesecondletters. Notethatdecodersdonotneedtotestthe
private-chunkpropertybit,sinceithasnofunctionalsignificance;itissimplyanadministrativecon-
veniencetoensurethatpublicandprivatechunknameswillnotconflict.SeeAdditionalchunktypes
(Section4.4)andRecommendationsforEncoders:Useofprivatechunks(Section9.8).
Reservedbit:bit5ofthirdbyte
Mustbe0(uppercase)infilesconformingtothisversionofPNG.
Thesignificanceofthecaseofthethirdletterofthechunknameisreservedforpossiblefutureex-
pansion. Atthepresenttimeallchunknamesmusthaveuppercasethirdletters. (Decodersshould
notcomplainaboutalowercasethirdletter,however,assomefutureversionofthePNGspecification
coulddefineameaningforthisbit.Itissufficienttotreatachunkwithalowercasethirdletterinthe
samewayasanyotherunknownchunktype.)
C# PDF File & Page Process Library SDK for C#.net, ASP.NET, MVC
Thumbnails. Page: Insert PDF Pages. Page: Delete Existing PDF Pages. Copy, Paste, Cut Image in Page. Link: Edit Redact Pages. Annotation & Drawing. Add Sticky Note
adding page numbers to a pdf document; add page numbers to pdf in preview
C# PDF File Compress Library: Compress reduce PDF size in C#.net
this PDF document compressing control is designed to offer C# developers to compress existing PDF documents in Embedded page thumbnails. Add necessary references
add a page to a pdf online; add a blank page to a pdf
3. FILESTRUCTURE
13
Safe-to-copybit:bit5offourthbyte
0(uppercase)=unsafetocopy,1(lowercase)=safetocopy.
Thispropertybitisnotofinteresttopuredecoders,butitisneededbyPNGeditors(programsthat
modifyPNGfiles).Thisbitdefinestheproperhandlingofunrecognizedchunksinafilethatisbeing
modified.
Ifachunk’ssafe-to-copybitis1,thechunkmaybecopiedtoamodifiedPNGfilewhetherornotthe
softwarerecognizesthechunktype,andregardlessoftheextentofthefilemodifications.
Ifachunk’ssafe-to-copybitis0,itindicatesthatthechunkdependsontheimagedata. Ifthepro-
gramhasmadeanychangestocriticalchunks,includingaddition,modification,deletion,orreorder-
ingofcriticalchunks,thenunrecognizedunsafechunksmustnotbecopiedtotheoutputPNGfile.
(Ofcourse,iftheprogramdoesrecognizethechunk,itcanchoosetooutputanappropriatelymodified
version.)
APNGeditorisalwaysallowedtocopyallunrecognizedchunksifithasonlyadded,deleted,modified,
orreorderedancillarychunks.Thisimpliesthatitisnotpermissibleforancillarychunkstodependon
otherancillarychunks.
PNGeditorsthatdonotrecognizeacriticalchunkmustreportanerrorandrefusetoprocessthatPNG
fileatall.Thesafe/unsafemechanismisintendedforusewithancillarychunks.Thesafe-to-copybit
willalwaysbe0forcriticalchunks.
RulesforPNGeditorsarediscussedfurtherinChunkOrderingRules(Chapter7).
Forexample,thehypotheticalchunktypename“bLOb”hasthepropertybits:
bLOb <- - 32 2 bit chunk type code represented in n text t form
||||
|||+- Safe-to-copy bit is 1 1 (lower r case letter; bit 5 5 is 1)
||+- Reserved bit is 0
(upper case e letter; bit t 5 5 is s 0)
|+-- Private bit t is 0
(upper case e letter; bit t 5 5 is s 0)
+--- Ancillary bit is 1
(lower case e letter; bit t 5 5 is s 1)
Therefore,thisnamerepresentsanancillary,public,safe-to-copychunk.
SeeRationale:Chunknamingconventions(Section12.13).
3.4 CRCalgorithm
ChunkCRCsarecalculatedusingstandardCRCmethodswithpreandpostconditioning,asdefinedbyISO
3309[ISO-3309]orITU-TV.42[ITU-V42].TheCRCpolynomialemployedis
The32-bitCRCregisterisinitializedtoall1’s,andthenthedatafromeachbyteisprocessedfromtheleast
significantbit(1)tothemostsignificantbit(128). Afterallthedatabytesareprocessed,theCRCregister
C# PDF insert image Library: insert images into PDF in C#.net, ASP
Add multiple images to multipage PDF document in .NET WinForms. Ability to put image into specified PDF page position and save existing PDF file or output a
adding page to pdf in preview; add page numbers to pdf document in preview
VB.NET PDF insert image library: insert images into PDF in vb.net
Add images to any selected PDF page in VB.NET. Ability to put image into defined location on PDF page. Save changes to existing PDF file or output a new PDF file
adding page numbers to pdf documents; add page to a pdf
14
PNG(PORTABLENETWORKGRAPHICS)SPECIFICATION
isinverted(itsonescomplementistaken). Thisvalueistransmitted(storedinthefile)MSBfirst. . Forthe
purposeofseparatingintobytesandordering,theleastsignificantbitofthe32-bitCRCisdefinedtobethe
coefficientofthe
term.
PracticalcalculationoftheCRCalwaysemploysaprecalculatedtabletogreatlyacceleratethecomputation.
SeeSampleCRCCode(Chapter15).
4 ChunkSpecifications
ThischapterdefinesthestandardtypesofPNGchunks.
4.1 Criticalchunks
Allimplementationsmustunderstandandsuccessfullyrenderthestandardcriticalchunks. AvalidPNG
imagemustcontainanIHDRchunk,oneormoreIDATchunks,andanIENDchunk.
4.1.1 IHDR R Imageheader
TheIHDRchunkmustappearFIRST.Itcontains:
Width:
4 bytes
Height:
4 bytes
Bit depth:
1 byte
Color type:
1 byte
Compression method: 1 byte
Filter method:
1 byte
Interlace method:
1 byte
Widthandheightgivetheimagedimensionsinpixels. Theyare4-byteintegers. . Zeroisaninvalidvalue.
Themaximumforeachis(2ˆ31)-1inordertoaccommodatelanguagesthathavedifficultywithunsigned
4-bytevalues.
Bitdepthisasingle-byteintegergivingthenumberofbitspersampleorperpaletteindex(notperpixel).
Validvaluesare1,2,4,8,and16,althoughnotallvaluesareallowedforallcolortypes.
Colortypeisasingle-byteintegerthatdescribestheinterpretationoftheimagedata.Colortypecodesrepre-
sentsumsofthefollowingvalues:1(paletteused),2(colorused),and4(alphachannelused).Validvalues
are0,2,3,4,and6.
Bitdepthrestrictionsforeachcolortypeareimposedtosimplifyimplementationsandtoprohibitcombina-
tionsthatdonotcompresswell. Decodersmustsupportalllegalcombinationsofbitdepthandcolortype.
Theallowedcombinationsare:
C# PDF Page Delete Library: remove PDF pages in C#.net, ASP.NET
applications to delete any unnecessary page from target existing PDF document file. C#.NET Project DLLs for Deleting PDF Document Page. Add necessary references
add pdf pages to word document; add pages to pdf document
VB.NET PDF Page Delete Library: remove PDF pages in vb.net, ASP.
Existing PDF Pages. |. Home ›› XDoc.PDF ›› VB.NET PDF: Delete PDF Page. DLLs for Deleting Page from PDF Document in VB.NET Class. Add necessary references:
add page to pdf reader; add page break to pdf
4. CHUNKSPECIFICATIONS
15
Color
Allowed
Interpretation
Type
Bit Depths
0
1,2,4,8,16
Each pixel l is a grayscale sample.
2
8,16
Each pixel l is an R,G,B triple.
3
1,2,4,8
Each pixel l is a palette index;
a PLTE E chunk k must appear.
4
8,16
Each pixel l is a grayscale sample,
followed by y an alpha sample.
6
8,16
Each pixel l is an R,G,B triple,
followed by y an alpha sample.
Thesampledepthisthesameasthebitdepthexceptinthecaseofcolortype3,inwhichthesampledepth
isalways8bits.
Compressionmethodisasingle-byteintegerthatindicatesthemethodusedtocompresstheimagedata.At
present,onlycompressionmethod0(deflate/inflatecompressionwitha32Kslidingwindow)isdefined.All
standardPNGimagesmustbecompressedwiththisscheme.Thecompressionmethodfieldisprovidedfor
possiblefutureexpansionorproprietaryvariants.Decodersmustcheckthisbyteandreportanerrorifitholds
anunrecognizedcode.SeeDeflate/InflateCompression(Chapter5)fordetails.
Filtermethodisasingle-byteintegerthatindicatesthepreprocessingmethodappliedtotheimagedatabe-
forecompression. Atpresent,onlyfiltermethod0(adaptivefilteringwithfivebasicfiltertypes)isdefined.
Aswiththecompressionmethodfield,decodersmustcheckthisbyteandreportanerrorifitholdsanunrec-
ognizedcode.SeeFilterAlgorithms(Chapter6)fordetails.
Interlacemethodisasingle-byteintegerthatindicatesthetransmissionorderoftheimagedata.Twovalues
arecurrentlydefined: 0(nointerlace)or1(Adam7interlace). SeeInterlaceddataorder(Section2.6)for
details.
4.1.2 PLTE E Palette
ThePLTEchunkcontainsfrom1to256paletteentries,eachathree-byteseriesoftheform:
Red:
1 byte e (0 0 = = black, 255 = red)
Green: 1 1 byte e (0 0 = = black, 255 = green)
Blue:
1 byte e (0 0 = = black, 255 = blue)
Thenumberofentriesisdeterminedfromthechunklength.Achunklengthnotdivisibleby3isanerror.
Thischunkmustappearforcolortype3,andcanappearforcolortypes2and6;itmustnotappearforcolor
types0and4.Ifthischunkdoesappear,itmustprecedethefirstIDATchunk.Theremustnotbemorethan
onePLTEchunk.
VB.NET PDF Password Library: add, remove, edit PDF file password
On this page, we will illustrate how to protect PDF document via Add necessary references Visual Basic coding example will help you open an encrypted PDF file.
add page numbers to pdf preview; add blank page to pdf
C# PDF Password Library: add, remove, edit PDF file password in C#
your PDF document in C# project, XDoc.PDF provides some PDF security settings. On this page, we will talk about how to achieve this via Add necessary references
add page number to pdf preview; adding a page to a pdf file
16
PNG(PORTABLENETWORKGRAPHICS)SPECIFICATION
Forcolortype3(indexedcolor),thePLTEchunkisrequired.ThefirstentryinPLTEisreferencedbypixel
value0,thesecondbypixelvalue1,etc. Thenumberofpaletteentriesmustnotexceedtherangethatcan
berepresentedintheimagebitdepth(forexample,2ˆ4=16forabitdepthof4). Itispermissibletohave
fewerentriesthanthebitdepthwouldallow. Inthatcase,anyout-of-rangepixelvaluefoundintheimage
dataisanerror.
Forcolortypes2and6(truecolorandtruecolorwithalpha),thePLTEchunkisoptional. Ifpresent,itpro-
videsasuggestedsetoffrom1to256colorstowhichthetruecolorimagecanbequantizediftheviewer
cannotdisplaytruecolordirectly.IfPLTEisnotpresent,suchaviewerwillneedtoselectcolorsonitsown,
butitisoftenpreferableforthistobedoneoncebytheencoder.(SeeRecommendationsforEncoders:Sug-
gestedpalettes,Section9.5.)
Notethatthepaletteuses8bits(1byte)persampleregardlessoftheimagebitdepthspecification. Inpar-
ticular,thepaletteis8bitsdeepevenwhenitisasuggestedquantizationofa16-bittruecolorimage.
Thereisnorequirementthatthepaletteentriesallbeusedbytheimage,northattheyallbedifferent.
4.1.3 IDAT T Imagedata
TheIDATchunkcontainstheactualimagedata.Tocreatethisdata:
1. BeginwithimagescanlinesrepresentedasdescribedinImagelayout(Section2.3);thelayoutandtotal
sizeofthisrawdataaredeterminedbythefieldsofIHDR.
2. FiltertheimagedataaccordingtothefilteringmethodspecifiedbytheIHDRchunk. . (Notethatwith
filtermethod0,theonlyonecurrentlydefined,thisimpliesprependingafiltertypebytetoeachscan-
line.)
3. CompressthefiltereddatausingthecompressionmethodspecifiedbytheIHDRchunk.
TheIDATchunkcontainstheoutputdatastreamofthecompressionalgorithm.
Toreadtheimagedata,reversethisprocess.
TherecanbemultipleIDATchunks;ifso,theymustappearconsecutivelywithnootherinterveningchunks.
ThecompresseddatastreamisthentheconcatenationofthecontentsofalltheIDATchunks.Theencoder
candividethecompresseddatastreamintoIDATchunkshoweveritwishes. (MultipleIDATchunksare
allowedsothatencoderscanworkinafixedamountofmemory;typicallythechunksizewillcorrespond
totheencoder’sbuffersize.) ItisimportanttoemphasizethatIDATchunkboundarieshavenosemantic
significanceandcanoccuratanypointinthecompresseddatastream.APNGfileinwhicheachIDATchunk
containsonlyonedatabyteislegal,thoughremarkablywastefulofspace.(Forthatmatter,zero-lengthIDAT
chunksarelegal,thoughevenmorewasteful.)
SeeFilterAlgorithms(Chapter6)andDeflate/InflateCompression(Chapter5)fordetails.
4. CHUNKSPECIFICATIONS
17
4.1.4 IEND D Imagetrailer
TheIENDchunkmustappearLAST. ItmarkstheendofthePNGdatastream. Thechunk’sdatafieldis
empty.
4.2 Ancillarychunks
Allancillarychunksareoptional,inthesensethatencodersneednotwritethemanddecoderscanignore
them. However,encodersareencouragedtowritethestandardancillarychunkswhentheinformationis
available,anddecodersareencouragedtointerpretthesechunkswhenappropriateandfeasible.
Thestandardancillarychunksarelistedinalphabeticalorder.Thisisnotnecessarilytheorderinwhichthey
wouldappearinafile.
4.2.1 bKGD D Backgroundcolor
ThebKGDchunkspecifiesadefaultbackgroundcolortopresenttheimageagainst. Notethatviewersare
notboundtohonorthischunk;aviewercanchoosetouseadifferentbackground.
Forcolortype3(indexedcolor),thebKGDchunkcontains:
Palette index:
1 byte
Thevalueisthepaletteindexofthecolortobeusedasbackground.
Forcolortypes0and4(grayscale,withorwithoutalpha),bKGDcontains:
Gray:
2 bytes, , range 0 0 .. (2ˆbitdepth)-1
(Forconsistency,2bytesareusedregardlessoftheimagebitdepth.)Thevalueisthegrayleveltobeused
asbackground.
Forcolortypes2and6(truecolor,withorwithoutalpha),bKGDcontains:
Red:
2 bytes, , range 0 0 .. (2ˆbitdepth)-1
Green: 2 2 bytes, , range 0 0 .. (2ˆbitdepth)-1
Blue:
2 bytes, , range 0 0 .. (2ˆbitdepth)-1
(Forconsistency,2bytespersampleareusedregardlessoftheimagebitdepth.)ThisistheRGBcolortobe
usedasbackground.
Whenpresent,thebKGDchunkmustprecedethefirstIDATchunk,andmustfollowthePLTEchunk,ifany.
SeeRecommendationsforDecoders:Backgroundcolor(Section10.7).
18
PNG(PORTABLENETWORKGRAPHICS)SPECIFICATION
4.2.2 cHRM M Primarychromaticitiesandwhitepoint
Applicationsthatneeddevice-independentspecificationofcolorsinaPNGfilecanusethecHRMchunk
tospecifythe1931CIEx,ychromaticitiesofthered,green,andblueprimariesusedintheimage,andthe
referencedwhitepoint.SeeColorTutorial(Chapter14)formoreinformation.
ThecHRMchunkcontains:
White Point x: 4 4 bytes
White Point y: 4 4 bytes
Red x:
4 bytes
Red y:
4 bytes
Green x:
4 bytes
Green y:
4 bytes
Blue x:
4 bytes
Blue y:
4 bytes
Eachvalueisencodedasa4-byteunsignedinteger,representingthexoryvaluetimes100000.Forexample,
avalueof0.3127wouldbestoredastheinteger31270.
cHRMisallowedinallPNGfiles,althoughitisoflittlevalueforgrayscaleimages.
Iftheencoderdoesnotknowthechromaticityvalues,itshouldnotwriteacHRMchunk;theabsenceofa
cHRMchunkindicatesthattheimage’sprimarycolorsaredevice-dependent.
IfthecHRMchunkappears,itmustprecedethefirstIDATchunk,anditmustalsoprecedethePLTEchunk
ifpresent.
SeeRecommendationsforEncoders:Encodercolorhandling(Section9.3),andRecommendationsforDe-
coders:Decodercolorhandling(Section10.6).
4.2.3 gAMA A Imagegamma
ThegAMAchunkspecifiesthegammaofthecamera(orsimulatedcamera)thatproducedtheimage,and
thusthegammaoftheimagewithrespecttotheoriginalscene.Moreprecisely,thegAMAchunkencodesthe
file_gammavalue,asdefinedinGammaTutorial(Chapter13).
ThegAMAchunkcontains:
Image gamma: 4 bytes
Thevalueisencodedasa4-byteunsignedinteger,representinggammatimes100000.Forexample,agamma
of0.45wouldbestoredastheinteger45000.
Iftheencoderdoesnotknowtheimage’sgammavalue,itshouldnotwriteagAMAchunk;theabsenceofa
gAMAchunkindicatesthatthegammaisunknown.
IfthegAMAchunkappears,itmustprecedethefirstIDATchunk,anditmustalsoprecedethePLTEchunk
ifpresent.
4. CHUNKSPECIFICATIONS
19
SeeGammacorrection(Section2.7),RecommendationsforEncoders: Encodergammahandling(Section
9.2),andRecommendationsforDecoders:Decodergammahandling(Section10.5).
4.2.4 hIST T Imagehistogram
ThehISTchunkgivestheapproximateusagefrequencyofeachcolorinthecolorpalette. Ahistogram
chunkcanappearonlywhenapalettechunkappears.Ifaviewerisunabletoprovideallthecolorslistedin
thepalette,thehistogrammayhelpitdecidehowtochooseasubsetofthecolorsfordisplay.
ThehISTchunkcontainsaseriesof2-byte(16bit)unsignedintegers.Theremustbeexactlyoneentryfor
eachentryinthePLTEchunk.Eachentryisproportionaltothefractionofpixelsintheimagethathavethat
paletteindex;theexactscalefactorischosenbytheencoder.
Histogramentriesareapproximate, withtheexceptionthatazeroentryspecifiesthatthecorresponding
paletteentryisnotusedatallintheimage.Itisrequiredthatahistogramentrybenonzeroifthereareany
pixelsofthatcolor.
Whenthepaletteisasuggestedquantizationofatruecolorimage,thehistogramisnecessarilyapproximate,
sinceadecodermaymappixelstopaletteentriesdifferentlythantheencoderdid. Inthissituation,zero
entriesshouldnotappear.
ThehISTchunk,ifitappears,mustfollowthePLTEchunk,andmustprecedethefirstIDATchunk.
SeeRationale:Palettehistograms(Section12.14),andRecommendationsforDecoders:Suggested-palette
andhistogramusage(Section10.10).
4.2.5 pHYs s Physicalpixeldimensions
ThepHYschunkspecifiestheintendedpixelsizeoraspectratiofordisplayoftheimage.Itcontains:
Pixels per unit, , X X axis: 4 4 bytes s (unsigned integer)
Pixels per unit, , Y Y axis: 4 4 bytes s (unsigned integer)
Unit specifier:
1 byte
Thefollowingvaluesarelegalfortheunitspecifier:
0: unit is unknown
1: unit is the meter
Whentheunitspecifieris0,thepHYschunkdefinespixelaspectratioonly;theactualsizeofthepixels
remainsunspecified.
Conversionnote:oneinchisequaltoexactly0.0254meters.
Ifthisancillarychunkisnotpresent,pixelsareassumedtobesquare,andthephysicalsizeofeachpixelis
unknown.
Ifpresent,thischunkmustprecedethefirstIDATchunk.
20
PNG(PORTABLENETWORKGRAPHICS)SPECIFICATION
SeeRecommendationsforDecoders:Pixeldimensions(Section10.2).
4.2.6 sBIT T Significantbits
Tosimplifydecoders,PNGspecifiesthatonlycertainsampledepthscanbeused,andfurtherspecifiesthat
samplevaluesshouldbescaledtothefullrangeofpossiblevaluesatthesampledepth.However,thesBIT
chunkisprovidedinordertostoretheoriginalnumberofsignificantbits.Thisallowsdecoderstorecoverthe
originaldatalosslesslyevenifthedatahadasampledepthnotdirectlysupportedbyPNG.Werecommend
thatanencoderemitansBITchunkifithasconvertedthedatafromalowersampledepth.
Forcolortype0(grayscale),thesBITchunkcontainsasinglebyte,indicatingthenumberofbitsthatwere
significantinthesourcedata.
Forcolortype2(truecolor),thesBITchunkcontainsthreebytes,indicatingthenumberofbitsthatwere
significantinthesourcedataforthered,green,andbluechannels,respectively.
Forcolortype3(indexedcolor),thesBITchunkcontainsthreebytes,indicatingthenumberofbitsthatwere
significantinthesourcedataforthered,green,andbluecomponentsofthepaletteentries,respectively.
Forcolortype4(grayscalewithalphachannel),thesBITchunkcontainstwobytes,indicatingthenumber
ofbitsthatweresignificantinthesourcegrayscaledataandthesourcealphadata,respectively.
Forcolortype6(truecolorwithalphachannel),thesBITchunkcontainsfourbytes,indicatingthenumber
ofbitsthatweresignificantinthesourcedataforthered,green,blueandalphachannels,respectively.
EachdepthspecifiedinsBITmustbegreaterthanzeroandlessthanorequaltothesampledepth(whichis
8forindexed-colorimages,andthebitdepthgiveninIHDRforothercolortypes).
AdecoderneednotpayattentiontosBIT:thestoredimageisavalidPNGfileofthesampledepthindicated
byIHDR. However,ifthedecoderwishestorecovertheoriginaldataatitsoriginalprecision,thiscanbe
donebyright-shiftingthestoredsamples(thestoredpaletteentries,foranindexed-colorimage).Theencoder
mustscalethedatainsuchawaythatthehigh-orderbitsmatchtheoriginaldata.
IfthesBITchunkappears,itmustprecedethefirstIDATchunk,anditmustalsoprecedethePLTEchunk
ifpresent.
SeeRecommendationsforEncoders: Sampledepthscaling(Section9.1)andRecommendationsforDe-
coders:Sampledepthrescaling(Section10.4).
4.2.7 tEXt t Textualdata
TextualinformationthattheencoderwishestorecordwiththeimagecanbestoredintEXtchunks. Each
tEXtchunkcontainsakeywordandatextstring,intheformat:
Keyword:
1-79 bytes (character string)
Null separator: 1 byte
Text:
n bytes (character string)
Documents you may be interested
Documents you may be interested