📄 jpgapi.c
字号:
SubjectDistanceoffchar[1]=(unsigned char)(santemp>>8);
SubjectDistanceoffchar[2]=(unsigned char)(santemp>>16);
SubjectDistanceoffchar[3]=(unsigned char)(santemp>>24);
//write the SUBJECT DISTANCE offset into the bitstream
memcpy (tempExif, SubjectDistanceoffchar, 4);
tempExif += 4 ;
SubjectDistanceNum[0]=jCtx->ExifInfo->SubjectDistanceNum;
SubjectDistanceDen[0]=jCtx->ExifInfo->SubjectDistanceDen;
SubjectDistanceNumChar[0]=(unsigned char)SubjectDistanceNum[0];
SubjectDistanceNumChar[1]=(unsigned char)(SubjectDistanceNum[0]>>8);
SubjectDistanceNumChar[2]=(unsigned char)(SubjectDistanceNum[0]>>16);
SubjectDistanceNumChar[3]=(unsigned char)(SubjectDistanceNum[0]>>24);
SubjectDistanceDenChar[0]=(unsigned char)SubjectDistanceDen[0];
SubjectDistanceDenChar[1]=(unsigned char)(SubjectDistanceDen[0]>>8);
SubjectDistanceDenChar[2]=(unsigned char)(SubjectDistanceDen[0]>>16);
SubjectDistanceDenChar[3]=(unsigned char)(SubjectDistanceDen[0]>>24);
//WRITE THE SUBJECT DISTANCE NUMERATOR
memcpy (startoftiff+santemp, SubjectDistanceNumChar, 4);
memcpy (startoftiff+santemp+4, SubjectDistanceDenChar, 4);
offset+=48;
///////////////ENTRY NO 8 :METERING MODE////////////////////////
//write METERING tag
memcpy (tempExif, MeteringModetag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, MeteringModeformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentMeteringMode, 4);
tempExif += 4 ;
//write METERING mode
MeteringMode[0] = jCtx->ExifInfo->MeteringMode;
MeteringModeChar[0] = (unsigned char)(MeteringMode[0]);
MeteringModeChar[1] = (unsigned char)(MeteringMode[0]>>8);
MeteringModeChar[2] = (unsigned char)(MeteringMode[0]>>16);
MeteringModeChar[3] = (unsigned char)(MeteringMode[0]>>24);
memcpy (tempExif, MeteringModeChar, 4);
tempExif += 4 ;
///////////////ENTRY NO 9 :FLASH////////////////////////
//write FLASH tag
memcpy (tempExif, Flashtag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, Flashformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentFlash, 4);
tempExif += 4 ;
//write FLASH mode
Flash[0]= jCtx->ExifInfo->Flash;
FlashChar[0] = (unsigned char)(Flash[0]);
FlashChar[1] = (unsigned char)(Flash[0]>>8);
FlashChar[2] = (unsigned char)(Flash[0]>>16);
FlashChar[3] = (unsigned char)(Flash[0]>>24);
memcpy (tempExif, FlashChar, 4);
tempExif += 4 ;
///////////////ENTRY NO 10 : FOCAL LENGTH////////////////////////
//write FOCAL LENGTH tag
memcpy (tempExif, FocalLengthtag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, FocalLengthformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentFocalLength, 4); //sanjeev
tempExif += 4 ;
//write FOCAL LENGTH
santemp=(int)(offset);
FocalLengthoffchar[0]=(unsigned char)santemp;
FocalLengthoffchar[1]=(unsigned char)(santemp>>8);
FocalLengthoffchar[2]=(unsigned char)(santemp>>16);
FocalLengthoffchar[3]=(unsigned char)(santemp>>24);
//write the FOCAL LENGTH offset into the bitstream
memcpy (tempExif, FocalLengthoffchar, 4);
tempExif += 4 ;
FocalLengthNum[0]=jCtx->ExifInfo->FocalLengthNum;
FocalLengthDen[0]=jCtx->ExifInfo->FocalLengthDen;
FocalLengthNumChar[0]=(unsigned char)FocalLengthNum[0];
FocalLengthNumChar[1]=(unsigned char)(FocalLengthNum[0]>>8);
FocalLengthNumChar[2]=(unsigned char)(FocalLengthNum[0]>>16);
FocalLengthNumChar[3]=(unsigned char)(FocalLengthNum[0]>>24);
FocalLengthDenChar[0]=(unsigned char)FocalLengthDen[0];
FocalLengthDenChar[1]=(unsigned char)(FocalLengthDen[0]>>8);
FocalLengthDenChar[2]=(unsigned char)(FocalLengthDen[0]>>16);
FocalLengthDenChar[3]=(unsigned char)(FocalLengthDen[0]>>24);
//WRITE THE FOCAL LENGTH NUMERATOR
memcpy (startoftiff+santemp, FocalLengthNumChar, 4);
memcpy (startoftiff+santemp+4, FocalLengthDenChar, 4);
offset+=48;
///////////////ENTRY NO 11 :Width////////////////////////
//write Width tag
memcpy (tempExif, Widthtag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, Widthformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentWidth, 4);
tempExif += 4 ;
//write Width
Width[0]=jCtx->ExifInfo->Width;
WidthChar[0] = (unsigned char)(Width[0]);
WidthChar[1] = (unsigned char)(Width[0]>>8);
WidthChar[2] = (unsigned char)(Width[0]>>16);
WidthChar[3] = (unsigned char)(Width[0]>>24);
memcpy (tempExif, WidthChar, 4);
tempExif += 4 ;
///////////////ENTRY NO 12 :Height////////////////////////
//write Height tag
memcpy (tempExif, Heighttag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, Heightformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentHeight, 4);
tempExif += 4 ;
//write Height
Height[0]=jCtx->ExifInfo->Height;
HeightChar[0] = (unsigned char)(Height[0]);
HeightChar[1] = (unsigned char)(Height[0]>>8);
HeightChar[2] = (unsigned char)(Height[0]>>16);
HeightChar[3] = (unsigned char)(Height[0]>>24);
memcpy (tempExif, HeightChar, 4);
tempExif += 4 ;
///////////////ENTRY NO 13 :COLORSPACE////////////////////////
//write ExposureProgram tag
memcpy (tempExif, ColorSpacetag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, ColorSpaceformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentColorSpace, 4);
tempExif += 4 ;
//write orientation mode
ColorSpace [0]= jCtx->ExifInfo->ColorSpace;
ColorSpaceChar[0] = (unsigned char)(ColorSpace[0]);
ColorSpaceChar[1] = (unsigned char)(ColorSpace[0]>>8);
ColorSpaceChar[2] = (unsigned char)(ColorSpace[0]>>16);
ColorSpaceChar[3] = (unsigned char)(ColorSpace[0]>>24);
memcpy (tempExif, ColorSpaceChar, 4);
tempExif += 4 ;
///////////////ENTRY NO 14 : FocalPlaneXResolution////////////////////////
//write EXPOSURE TIME tag
memcpy (tempExif, FocalPlaneXResolutiontag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, FocalPlaneXResolutionformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentFocalPlaneXResolution, 4);
tempExif += 4 ;
//write EXPOSURE TIME
santemp=(int)(offset);
FocalPlaneXResolutionoffchar[0]=(unsigned char)santemp;
FocalPlaneXResolutionoffchar[1]=(unsigned char)(santemp>>8);
FocalPlaneXResolutionoffchar[2]=(unsigned char)(santemp>>16);
FocalPlaneXResolutionoffchar[3]=(unsigned char)(santemp>>24);
//write the X-Resolution offset into the bitstream
memcpy (tempExif, FocalPlaneXResolutionoffchar, 4);
tempExif += 4 ;
FocalPlaneXResolutionNum[0] = jCtx->ExifInfo->FocalPlaneXResolutionNum;
FocalPlaneXResolutionDen[0] = jCtx->ExifInfo->FocalPlaneXResolutionDen;
FocalPlaneXResolutionNumChar[0]=(unsigned char)FocalPlaneXResolutionNum[0];
FocalPlaneXResolutionNumChar[1]=(unsigned char)(FocalPlaneXResolutionNum[0]>>8);
FocalPlaneXResolutionNumChar[2]=(unsigned char)(FocalPlaneXResolutionNum[0]>>16);
FocalPlaneXResolutionNumChar[3]=(unsigned char)(FocalPlaneXResolutionNum[0]>>24);
FocalPlaneXResolutionDenChar[0]=(unsigned char)FocalPlaneXResolutionDen[0];
FocalPlaneXResolutionDenChar[1]=(unsigned char)(FocalPlaneXResolutionDen[0]>>8);
FocalPlaneXResolutionDenChar[2]=(unsigned char)(FocalPlaneXResolutionDen[0]>>16);
FocalPlaneXResolutionDenChar[3]=(unsigned char)(FocalPlaneXResolutionDen[0]>>24);
//WRITE THE EXPOSURE TIME NUMERATOR
memcpy (startoftiff+santemp, FocalPlaneXResolutionNumChar, 4);
memcpy (startoftiff+santemp+4, FocalPlaneXResolutionDenChar, 4);
offset+=48;
///////////////ENTRY NO 15 : FocalPlaneYResolution////////////////////////
//write EXPOSURE TIME tag
memcpy (tempExif, FocalPlaneYResolutiontag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, FocalPlaneYResolutionformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentFocalPlaneYResolution, 4); //sanjeev
tempExif += 4 ;
//write EXPOSURE TIME
santemp=(int)(offset);
FocalPlaneYResolutionoffchar[0]=(unsigned char)santemp;
FocalPlaneYResolutionoffchar[1]=(unsigned char)(santemp>>8);
FocalPlaneYResolutionoffchar[2]=(unsigned char)(santemp>>16);
FocalPlaneYResolutionoffchar[3]=(unsigned char)(santemp>>24);
//write the X-Resolution offset into the bitstream
memcpy (tempExif, FocalPlaneYResolutionoffchar, 4);
tempExif += 4 ;
FocalPlaneYResolutionNum[0] = jCtx->ExifInfo->FocalPlaneYResolutionNum;
FocalPlaneYResolutionDen[0] = jCtx->ExifInfo->FocalPlaneYResolutionDen;
FocalPlaneYResolutionNumChar[0]=(unsigned char)FocalPlaneYResolutionNum[0];
FocalPlaneYResolutionNumChar[1]=(unsigned char)(FocalPlaneYResolutionNum[0]>>8);
FocalPlaneYResolutionNumChar[2]=(unsigned char)(FocalPlaneYResolutionNum[0]>>16);
FocalPlaneYResolutionNumChar[3]=(unsigned char)(FocalPlaneYResolutionNum[0]>>24);
FocalPlaneYResolutionDenChar[0]=(unsigned char)FocalPlaneYResolutionDen[0];
FocalPlaneYResolutionDenChar[1]=(unsigned char)(FocalPlaneYResolutionDen[0]>>8);
FocalPlaneYResolutionDenChar[2]=(unsigned char)(FocalPlaneYResolutionDen[0]>>16);
FocalPlaneYResolutionDenChar[3]=(unsigned char)(FocalPlaneYResolutionDen[0]>>24);
//WRITE THE EXPOSURE TIME NUMERATOR
memcpy (startoftiff+santemp, FocalPlaneYResolutionNumChar, 4);
memcpy (startoftiff+santemp+4, FocalPlaneYResolutionDenChar, 4);
offset+=48;
///////////////ENTRY NO 16 :FocalPlaneResolutionUnit////////////////////////
//write ExposureProgram tag
memcpy (tempExif, FocalPlaneResolutionUnittag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, FocalPlaneResolutionUnitformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentFocalPlaneResolutionUnit, 4);
tempExif += 4 ;
//write FocalPlaneResolutionUnit
FocalPlaneResolutionUnit[0] = jCtx->ExifInfo->FocalPlaneResolutionUnit;
FocalPlaneResolutionUnitChar[0] = (unsigned char)(FocalPlaneResolutionUnit[0]);
FocalPlaneResolutionUnitChar[1] = (unsigned char)(FocalPlaneResolutionUnit[0]>>8);
FocalPlaneResolutionUnitChar[2] = (unsigned char)(FocalPlaneResolutionUnit[0]>>16);
FocalPlaneResolutionUnitChar[3] = (unsigned char)(FocalPlaneResolutionUnit[0]>>24);
memcpy (tempExif, FocalPlaneResolutionUnitChar, 4);
tempExif += 4 ;
///////////////ENTRY NO 17 :UserComments////////////////////////
//write model tag
memcpy (tempExif, UserCommentstag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, UserCommentsformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentUserComments, 4); //sanjeev
tempExif += 4 ;
//write model
// strcpy(model,tpJEInfo->Model);
memcpy(UserComments,jCtx->ExifInfo->UserComments,150);
santemp=(int)(offset);
UserCommentsoffchar[0]=(unsigned char)santemp;
UserCommentsoffchar[1]=(unsigned char)(santemp>>8);
UserCommentsoffchar[2]=(unsigned char)(santemp>>16);
UserCommentsoffchar[3]=(unsigned char)(santemp>>24);
//write the User Comments offset into the bitstream
memcpy (tempExif, UserCommentsoffchar, 4);
tempExif += 4 ;
memcpy (startoftiff+santemp, UserComments, 128);
offset+=128;
///////////////ENTRY NO 18 :WHITE BALANCE////////////////////////
//write WhiteBalance tag
memcpy (tempExif, WhiteBalancetag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, WhiteBalanceformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentWhiteBalance, 4);
tempExif += 4 ;
//write orientation mode
WhiteBalance[0] = jCtx->ExifInfo->WhiteBalance;
WhiteBalanceChar[0] = (unsigned char)(WhiteBalance[0]);
WhiteBalanceChar[1] = (unsigned char)(WhiteBalance[0]>>8);
WhiteBalanceChar[2] = (unsigned char)(WhiteBalance[0]>>16);
WhiteBalanceChar[3] = (unsigned char)(WhiteBalance[0]>>24);
memcpy (tempExif, WhiteBalanceChar, 4);
tempExif += 4 ;
if(jCtx->thumbnailFlag)
{
//Go back where IFD1 Offset is stored and store there the actual offset of IFD1
santemp=(int)(tempExif - startoftiff);
SubIFDOffsetChar[0] = (unsigned char)(santemp);
SubIFDOffsetChar[1] = (unsigned char)(santemp>>8);
SubIFDOffsetChar[2] = (unsigned char)(santemp>>16);
SubIFDOffsetChar[3] = (unsigned char)(santemp>>24);
memcpy (IFD1OffsetAddress, SubIFDOffsetChar, 4);
/////////////EXIF IFD1 STARTS HERE//////////////////////////////////
//write no of entries in SubIFD
memcpy (tempExif, IFD1Nentries, 2);
tempExif += 2 ;
///////////////ENTRY NO 1 :Compression Type////////////////////////
//write Compression tag
memcpy (tempExif, Compressiontag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, Compressionformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentCompression, 4);
tempExif += 4 ;
//write orientation mode
CompressionChar[0] = (unsigned char)(Compression[0]);
CompressionChar[1] = (unsigned char)(Compression[0]>>8);
CompressionChar[2] = (unsigned char)(Compression[0]>>16);
CompressionChar[3] = (unsigned char)(Compression[0]>>24);
memcpy (tempExif, CompressionChar, 4);
tempExif += 4 ;
///////////////ENTRY NO 2 : X - RESOLUTION OF THE IMAGE////////////////////////
//write model tag
memcpy (tempExif, XResolutiontag, 2);
tempExif += 2 ;
//write format
memcpy (tempExif, XResolutionformat, 2);
tempExif += 2 ;
//write no of component
memcpy (tempExif, NcomponentXResolution, 4); //sanjeev
tempExif += 4 ;
//write X - Resolution
santemp=(int)(offset);
XResolutionoffchar[0]=(unsigned char)santemp;
XResolutionoffchar[1]=(unsigned char)(santemp>>8);
XResolutionoffchar[2]=(unsigned char)(santemp>>16);
XResolutionoffchar[3]=(unsigned char)(santemp>>24);
//write the X-Resolution offset into the bitstream
memcpy (tempExif, XResolutionoffchar, 4);
tempExif += 4 ;
XResolutionNum[0] = jCtx->ExifInfo->XResolutionNum;
XResolutionDen[0] = jCtx->ExifInfo->XResolutionDen;
XResolutionNumChar[0]=(unsigned char)XResolutionNum[0];
XResolutionNumChar[1]=(unsigned char)(XResolutionNum[0]>>8);
XResolutionNumChar[2]=(unsigned char)(XResolutionNum[0]>>16);
XResolutionNumChar[3]=(unsigned char)(XResolutionNum[0]>>24);
XResolutionDenChar[0]=(unsigned char)XResolutionDen[0];
XResolutionDenChar[1]=(unsigned char)(XResolutionDen[0]>>8);
XResolutionDenChar[2]=(unsigned char)(XResolutionDen[0]>>16);
XResolutionDenChar[3]=(unsigned char)(XResolutionDen[0]>>24);
//WRITE THE X - RESOLUTION NUMERATOR
memcpy (startoftiff+santemp, XResolutionNumChar, 4);
memcpy (startoftiff+santemp+4, XResolutionDenChar, 4);
offset+=48;
///////////////ENTRY NO 3 : Y - RESOLUTION OF THE IMAGE////////////////////////
//write model tag
memcpy (tempExif, YResolutiontag, 2);
tempExif += 2 ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -