1.3. IMAGEFILEI/OREQUIREMENTS
9
Line
0
char *in_name, , *out_name;
1
short **the_image;
2
long height, , width;
3
create_image_file(in_name, out_name);
4
get_image_size(in_name, &height, , &width);
5
the_image = = allocate_image_array(height, width);
6
read_image_array(in_name, the_image);
7
call an image processing routine
8
write_image_array(out_name, the_image);
9
free_image_array(the_image, height);
Figure1.1:ASampleProgram
inputle(TIFForBMP)doesnotmatter.Line7iswheretheprogrammer
callsthedesiredprocessingroutine. Line8writestheresultingimagearray
totheoutputle,andline9freesthememoryarrayallocatedinline5.
Theroutinesingure1.1arethetop-levelofafamilyofroutines. These
hide the imagele detailsfromtheprogrammer. . Theunderlyingroutines
do the specic work. . This s structure removes allle I/O from the image
processingroutines. Allroutinesreceive e anarray of numbers andthesize
ofthearray.Thisimprovestheportabilityoftheimageprocessingroutines.
Theydonotdependonimageformatsorsources.
Thisstructurealsomakesiteasiertoaddmoreimageleformats. The
read
image
arrayfunctionridesontopofasetofroutinesthatdeterminethe
specicleformatandreadit.Addingnewroutinesbelowread
image
array
willnotaectthevastmajorityofcodeintheimageprocessingsystem.
Listing 1.1showsthehigh-levelI/O routines. . Itbegins s with the basic
read
image
arrayandwrite
image
array. Theseroutines s callroutines that
checktheleformatandcallthereadandwriteroutines forthosespecic
formats. Addingnewleformatsmeansaddingcallstothoseroutineshere.
Thenextroutineinlisting1.1iscreate
image
le. Italsocallsroutinesto
determinethespecicleformatandcreatelesforthoseformats.
Conversion of pdf to ppt online - C# Create PDF from PowerPoint Library to convert pptx, ppt to PDF in C#.net, ASP.NET MVC, WinForms, WPF
Online C# Tutorial for Creating PDF from Microsoft PowerPoint Presentation
pdf to powerpoint converter online; adding pdf to powerpoint
Conversion of pdf to ppt online - VB.NET Create PDF from PowerPoint Library to convert pptx, ppt to PDF in vb.net, ASP.NET MVC, WinForms, WPF
VB.NET Tutorial for Export PDF file from Microsoft Office PowerPoint
convert pdf to powerpoint slides; convert pdf to powerpoint slide
10
CHAPTER1. IMAGEFILEINPUTANDOUTPUT
Theget
image
sizeroutinedeterminesthesizeoftheimagetoprocess.
Thisinformationisneededtoallocateimagearraysandtopasstoprocessing
routines. Theprocessingroutineswillreceiveapointer r toanarray. . They
mustalsoreceivethesizeoftheimageortheycannotprocessthroughthe
numbers. Theget
image
sizeroutinedeterminesthespecicleformatand
callsroutinestoreadtheimageheaders.
Thenexttworoutines,allocate
image
arrayandfree
image
array,create
andfreememoryforarraysofnumbers. Thiscompletestheroutinesshown
ingure1.1. Theremainingroutinesinlisting1.1areusedinmanyofthe
programspresentedinthisbook. Like e the routines describedearlier, , they
rideontopofotherroutinesthatworkwithspecicimageleformats.They
createles,determineiflesexist,manipulateheaders,andpullimportant
informationfromimageheaders.
1.4 TIFF
Severalcomputer andscanner companies createdanindustrystandardfor
digitalimagedatacommunication[1.1]. Theircollaborationresultedinthe
TIFFspecication. Sincemostscannermanufacturerssupportthestandard
intheirPCandMacintoshproducts,TIFFisanaturalforPC-basedimage
processing.
The goals s of f the e TIFF specication n are e extensibility, portability, and
revisability. TIFFmustbeextensibleinthefuture. . TIFF F mustbeableto
adapttonewtypesofimagesanddataandmustbeportablebetweendierent
computers,processors,andoperatingsystems.TIFFmustberevisable|it
isnotaread-onlyformat. Softwaresystemsshouldbeabletoedit,process,
andchangeTIFFles.
ThetaginTagImageFileFormatreferstothele’sbasicstructure. A
TIFF tagprovidesinformationabouttheimage,suchasitswidth,length,
andnumberofpixels. Tagsareorganizedintagdirectories. Tagdirectories
havenosetlengthornumber,sincepointersleadfromonedirectorytoan-
other. Theresultis s a exibleleformatthatcangrowandsurviveinthe
future.Figure1.2containstheexistingstandardtags.Figure1.3showsthe
structure ofTIFF. . Therst t eight bytes of thele are theheader. . These
eightbyteshavethesameformatonallTIFFles.Theyaretheonlyitems
setinconcreteforTIFF les. . Theremainderofthelediersfromimage
toimage. TheIFD,orImageFileDirectory,containsthenumberofdirec-
Online Convert PowerPoint to PDF file. Best free online export
by clicking on the blue button or drag-and-drop your pptx or ppt file into Then just wait until the conversion from Powerpoint to PDF is complete
how to convert pdf to powerpoint; and paste pdf into powerpoint
How to C#: Convert PDF, Excel, PPT to Word
How to C#: Convert PDF, Excel, PPT to Word. Online C# Tutorial for Converting PDF, MS-Excel, MS-PPT to Word. PDF, MS-Excel, MS-PPT to Word Conversion Overview.
convert pdf to editable powerpoint online; pdf to ppt converter online for large
1.4. TIFF
11
toryentriesandthedirectoryentriesthemselves.Theright-handcolumnin
Figure1.2showsthestructureofeachdirectoryentry. Eachentrycontains
atagindicatingwhattypeofinformationtheleholds,thedatatypeofthe
information,thelengthoftheinformation,andapointertotheinformation
ortheinformationitself.
Figure1.4showsthebeginningofaTIFFle. Theaddressesarelocated
ontheleftsideindecimal,andthebytesandtheirvaluesareinthetablein
hex.
GlancingbetweenFigures1.3and1.4shouldclarifythestructure. The
rsteightbytesaretheheader.Byteszeroandonetellwhetherthelestores
numberswiththemostsignicantbyte(MSB)rst,orleastsignicantbyte
(LSB)rst. IfbyteszeroandoneareII(0x4949),thentheleastsignicant
byteisrst(predominantinthePCworld). IfthevalueisMM(0x4D4D),
themostsignicantbyteisrst(predominantintheMacintoshworld).Your
softwareneedstoreadbothformats.
TheexampleinFigure1.4showsLSBrst.Bytestwoandthreegivethe
TIFFversionnumber,whichshouldbe42(0x2A)inallTIFFimages.Bytes
fourtosevengivethe osetto the rstImageFileDirectory(IFD).Note
thatallosetsinTIFF indicatelocationswithrespecttothebeginningof
thele. Therstbyteinthelehastheoset0.TheosetinFigure1.4is
8,sotheIFDbeginsinbytenineofthele.
1.4.1 TheIFD
Thecontent of address eightis27,indicatingthatthis lehas2712-byte
directory entries. . The e rst two bytesof theentry containthe tag,which
tells the type e of information n the entry y contains. . The e directory y entry y at
location0(Figure1.4)containstag=255.Thistagtellstheletype.(Refer
toFigure1.2for possible tags.) ) Thenext t twobytesofthe entry givethe
data typeof the information(Figure 1.5lists thepossible data typesand
theirlengths). Directoryentry0inFigure1.4istype=3,ashort(two-byte
unsignedinteger). Thenextfourbytesoftheentry y givethelengthofthe
information.Thislengthisnotinbytes,butratherinmultiplesofthedata
type. Ifthe e data type is ashort and the lengthis one,the lengthis one
short,ortwobytes. Anentry’snalfourbytesgiveeitherthevalueofthe
informationorapointertothevalue. Ifthesizeoftheinformationisfour
bytesorless,theinformationisstoredhere.Ifitislongerthanfourbytes,a
pointertoitisstored. Theinformationindirectoryentryzeroistwobytes
C# PDF Convert: How to Convert MS PPT to Adobe PDF Document
merge PDF files, VB.NET view PDF online, VB.NET PDF Convert: How to Convert MS PPT to Adobe Provide Free Demo Code for PDF Conversion from Microsoft PowerPoint
pdf into powerpoint; image from pdf to powerpoint
C# Tiff Convert: How to Convert PDF, Word, Excel, PowerPoint, Jpeg
can perform rapid and high quality file conversion between PPT and PDF PDF to Tiff Conversion. transform and convert Tiff image file to Adobe PDF document, then
embed pdf into powerpoint; how to convert pdf slides to powerpoint presentation
12
CHAPTER1. IMAGEFILEINPUTANDOUTPUT
SubfileType
Tag = 255 (FF)
Type = short
N = 1
Indicates the kind d of data in the e subfile.
ImageWidth
Tag = 256 (100)
Type = short
N = 1
The width (x or r horizontal) ) of the image e in pixels.
ImageLength
Tag = 257 (101)
Type = short
N = 1
The length h (y y or height or r vertical) ) of the e image e in pixels.
RowsPerStrip
Tag = 278 (116)
Type = long
N = 1
The number r of f rows s per r strip.
The default is the e entire e image in one strip.
StripOffsets
Tag = 273 (111)
Type = short or long g N N = strips s per r image
The byte offset t for r each strip.
StripByteCounts
Tag = 279 (117)
Type = long
N = 1
The number r of f bytes in each strip.
SamplesPerPixel
Tag = 277 (115)
Type = short
N = 1
The number r of f samples s per r pixel
(1 for monochrome data, 3 for r color).
BitsPerSample
Tag = 258 (102)
Type = short
N = SamplesPerPixel
The number r of f bits s per r pixel. . 2**BitsPerSample e = # # of gray levels.
Figure1.2:ExistingStandardTIFFTags
How to C#: Convert Word, Excel and PPT to PDF
to C#: Convert Word, Excel and PPT to PDF. Online C# Tutorial for Converting MS Office Word, Excel and PowerPoint to PDF. MS Office to PDF Conversion Overview.
how to convert pdf to ppt; conversion of pdf into ppt
C# TIFF: Learn to Convert MS Word, Excel, and PPT to TIFF Image
C# TIFF - Conversion from Word, Excel, PPT to TIFF. Learn How to Change MS Word, Excel, and PowerPoint to TIFF Image File in C#. Overview
pdf page to powerpoint; how to convert pdf file to powerpoint presentation
1.4. TIFF
13
Figure1.3: TheStructureofaTIFFFile
VB.NET PowerPoint: Convert & Render PPT into PDF Document
This VB.NET PowerPoint to PDF conversion tutorial will illustrate our effective PPT to PDF converting control SDK from following aspects.
pdf picture to powerpoint; pdf to powerpoint converter
VB.NET PowerPoint: Complete PowerPoint Document Conversion in VB.
to use our VB.NET PowerPoint Conversion Control to image or document formats, such as PDF, BMP, TIFF documents that can be converted from PPT document, please
convert pdf slides to powerpoint online; how to convert pdf to ppt online
14
CHAPTER1. IMAGEFILEINPUTANDOUTPUT
address
contents
(decimal)
(hex)
header
0
49 49
2
2A 00
4
08 00 0 00 0 00
IFD
8
1B 00
0th directory entry
10
FF 00
tag=255
12
03 00
type=3 (short)
14
01 00 00 0 00
length=1
18
01 00 00 0 00
value=1
1rst directory entry
22
00 01
tag=256
24
03 00
type=3 (short)
26
01 00 00 0 00
length=1
30
58 02 00 0 00
value=600
2nd directory entry
34
01 01
tag=257
36
03 00
type=3 (short)
38
01 00 00 0 00
length=1
42
5A 02 00 0 00
value=602
.
.
.
offset to o next IFD
334
00 00 0 00 0 00
offset=0 so o there e are e no o more IFD’s
Figure1.4:TheBeginningofaTIFFFile
VB.NET PowerPoint: PPTX to SVG Conversion; Render PPT to Vector
add-on allows developers to perform high-quality PPT (.pptx) to svg conversion in both to provide powerful & profession imaging controls, PDF document, tiff
how to convert pdf to powerpoint on; how to change pdf file to powerpoint
1.4. TIFF
15
Type
Length of f the Type
1 = byte
8 bit unsigned d integer
2 = ASCII
8 bit bytes that store e ASCII codes
(the last byte must be null)
3 = short
16 bit t (2 2 byte) ) unsigned d integer
4 = long
32 bit t (4 4 byte) ) unsigned d integer
5 = rational
Two long’s: The e first t is the numerator,
the second d is s the denominator
Figure1.5:PossibleDataTypesandLengths
longandisstoredherewithavalueof1.(Thisvaluehasnomeaningforthis
tag.)
Asforthenexttwoentries,therstentryhastag=256.Thisistheimage
widthoftheimageinnumberofcolumns.Thetypeisshortandthelength
ofthevalueisoneshort,ortwobytes. Thevalue600meansthatthereare
600columnsintheimage.Thesecondentryhastag=257.Thisistheimage
lengthorheightinnumberofrows. Thetypeisshort,thelengthisone,and
thevalueis602,meaningthattheimagehas602rows.
Youcontinuethroughthedirectory entriesuntilyoureachtheosetto
thenextIFD.Ifthisosetis0,asinFigure1.4,nomoreIFDsfollowinthe
le.
1.4.2 TheTIFFCode
ThecodeinListing1.2reads imagearrays fromandwrites themtoTIFF
les.Thecodeworkswitheight-bitgrayscaleTIFFimages.Itsitsonelevel
closertothelesthanthegeneralroutinesgiveninlisting1.1.
Listing1.4(cips.hshownlater)containsthe#includeles,constantsand
thedatastructures.Thestructureti
header
structholdstheessentialtags
wemustextractfromtheTIFFheader.
Thefunctionread
ti
headerinListing1.2rstdetermineswhetherthe
leusesLSB-rstorMSB-rstsincethemethodusedin uencesthemanner
inwhichthefunctionsextract
long
from
buerandextract
short
from
buer
read the remainder of the le header. . Next, , the e oset to the Image File
Directory is read. . The e nextsectionseeks tothe IFD and reads theentry
16
CHAPTER1. IMAGEFILEINPUTANDOUTPUT
count, or number of entries in the IFD. Finally, the e code loops over r the
numberofentries.Itreadseachentryandpicksoutthenecessarytags. The
essentialinformationisthewidthandlengthoftheimage,thebitsperpixel
(four-bitoreight-bitdata),andtheosettothestartofthedata.
Thefunctionread
ti
imageinListing1.2usesread
ti
headerandthe
headerinformationtoreaddataintoanarrayofshorts. Thecodeseeksto
thebeginningofthedataandloopsthroughthelinesintheimagetoread
allthedata. Thefunctionread
linereadstheimagedataintoabuer,and
places the datainto the array of shorts. . read
line uses unions denedin
cips.handalsodependsonthenumberofbitsperpixel.
ThenextfunctionsinListing1.2writeTIFFlestodisk. Thefunction
create
ti
le
if
neededreceivesthenameofaninputleandanoutputle
andlooksforthatoutputleonthedisk.Iftheoutputledoesnotexist,it
createsittobethesamebasicsizeastheinputle.create
ti
le
if
needed
usesthefunctionsdoes
not
existandcreate
allocate
ti
le,bothdescribed
below,tocheckfortheexistenceoftheoutputleandtocreateit.
ThenextfunctioninListing1.2iscreate
allocate
ti
le. Thisfunction
takesinalenameandinformationabouttheTIFFleheaderandcreates
aleondisk. Itallocatesdiskspacebywritingenoughzerostotheleto
holdanimage.Theimagewidthandlengthspeciedintheti
header
struct
indicatehowlargeanimagethedisklemustbeabletohold.Inwritingthe
leheader,create
allocate
ti
lealwaysspeciestheleast-signicant-byte-
rst(LSB)order.ItgoesontowriteallthetagsrequiredbythenewTIFF
[1.1]specicationforgrayscaleimageles. Afterwritingtheleheader,it
goesintoaloopandwritesoutbytesofzerostothele.
The next function in Listing 5.1 is write
ti
image. Image e processing
functionswillusethistowriteanarrayofpixelsintoexistingTIFFles. It
takesinthelename,looksattheleheader,andusestheheaderinforma-
tiontowriteanarrayofpixelsintothele.Itsformissimilartothatofthe
functionread
ti
imageshownabove.Thefunctionwrite
ti
imageseeksto
wheretheimagedatabeginsandloopsthroughthewritingthelines.
Thefunctionwrite
line (shownnextinListing 1.2)actually writes the
bytesintothele. Itconvertstheshortvalues(16bits)toeithereight- - or
four-bitvaluesandwritesthem.
Theotherfunctions inthe listingareoften-usedutilities. . Thefunction
is
a
tilooksatthelenameandheaderinformationtodeterminealeisa
TIFFle. Thefunctionequate
image
headerssetstheprimaryinformation
oftwoimageheaderstobeequal. Thefollowingfunctionsinsertshortsand
1.5. BMP
17
longsintoandextractsthemfrombuers. TheTIFFI/Ofunctionsinthis
listingandtheBMPlefunctionsinlisting1.3usetheseutilities.
1.5 BMP
TheMicrosoftWindowsBitmap(BMP)leformatisabasicleformatfor
digitalimagesintheMicrosoftWindowsworld.TheBMPformatissimpler
andless capablethantheTIFFformat. . Itdoeswhatitissupposedtodo
|storedigitalimages,buttechnicallyisnot as goodasTIFF.Simplicity,
however,isablessinginthatthelesareeasiertoreadandwrite.
This is the native graphics formatfor the Windows world,so thevast
majorityofWindows-basedsoftwareapplicationssupportthisformat.Since
BMPwas createdforMicrosoftWindows,itwascreatedfor the Intelpro-
cessorsonly.Hence,itisallleastsignicantbyterst.Thisdiersfromthe
TIFFdiscussedearlierwhereitcouldbeeitherleastormostsignicantbyte
rst. Microsoft’sPaintprogram(freewithallWindows) ) workswithBMP
les,soeveryoneusingWindowscandisplayandprintBMPles.Thedown
sideofBMPisthatmostUNIXsystemsdonotsupportBMPles.
TheBMPleformathasgrownandchangedasMicrosoftWindowshas
grownandchanged.ThereareveorsixdierentversionsofBMPles.The
codepresentedhereinworkswithversionofBMPcreatedforWindows3.x,
eightbitsperpixel,grayshades,nocompression.
AnexcellentsourceofinformationforBMPandallotherimagelefor-
matsis[1.2].FurtherinformationforBMPisin[1.3]and[1.4]whilesource
codetoreadandwriteallBMPformatsisavailableat[1.5]and[1.6].
BMPleshave(1)aleheader,(2)abitmapheader,(3)acolortable,
and(4)theimagedata. Thele e header,showningure1.6,occupiesthe
rst 14bytes ofallBMPles. . The e rsttwo bytes are the letypewhich
always equals 4D42 hex or ‘BM.’Thenext four bytes givethe size ofthe
BMPle. Thenexttwobytes s arereservedandarealways zero. . Thelast
fourbytesoftheheadergivetheosettotheimagedata.Thisvaluepoints
towhereintheletheimagedatabegins. Thisvalue,andthe e otherfour
bytevaluesintheheader,isanunsignednumber(alwayspositive).
Thenext40bytes,showningure1.7,arethebitmapheader.Theseare
uniquetothe3.xversionofBMPles.Thebitmapheaderbeginswiththe
sizeoftheheader(always40).Nextcomethewidthandheightoftheimage
data(thenumbersofcolumnsandrows).Iftheheightisanegativenumber,
18
CHAPTER1. IMAGEFILEINPUTANDOUTPUT
Figure1.6:TheBMPFileHeader
the imageis storedbottom-up. . That t is the normalformatforBMPles.
Thenumberofcolorplanesisusually1.Thebitsperpixelisimportant.My
codeworkswitheightbitsperpixelonlytoprovide256shadesofgray.
Thenexttwoeldsdealwithimagedatacompression. Thecompression
eldis0fornocompressionand1forrunlengthencodingcompression.My
code does not work k with compression. . The e size of bitmapeld gives the
size of the imagedata when the data is compressed. . It t is zerowhen not
compressed,andthesoftwarecalculatesthesizeofthedata.
Thenext two elddealwith the resolution of theimage data and the
naltwodealwiththecolorsorgray shadesintheimage. . Thehorizontal
andverticalresolutionsare expressedinpixels permeter. . Thecolor r elds
helpthesoftwaredecipherthecolortablediscussedbelow. Thecolorseld
stateshowmanycolorsorgrayshadesareintheimage. Theimagesdonot
alwayshave256grayshades.Ifonly30arepresent,thiseldequals30and
the colortable only has30 entries. . Theimportantcolors s eldstates how
manyofthecolorsareimportanttotheimage.
Aftertheheaderscomethecolortable. Acolortableisalookuptable
thatassignsagrayshadeorcolortoanumbergivenintheimagedata. In
BMPles,justbecausethenumber12isintheimagedatadoesnotmean
thatthepixelisthe12thdarkestgrayshade.Itmeansthatthepixelhasthe
grayshadegiveninthe12thplaceinthecolortable.Thatgrayshademight
be 100,200,oranything. . Colortables s oertheopportunitytosavespace
inimagelesandtomatchtheimagecolorstoadisplayorprintingdevice.
Theydonotplayanimportantroleintheimageprocessingroutinesinthis
text.
Documents you may be interested
Documents you may be interested