Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

image.save file size
Xref: TK2MSFTNGP08.phx.gbl microsoft.public.vstudio.general:24259 microsoft.
public.vstudio.development:23275

Hi,

I did a program that read my jpeg file from my canon a80 camera and get the
date of picture taken that is stored into the jpeg file as a propertyid
once this date and time is extracted, I give the user 2 choise either rename
the jpeg file to DateTimeOfpitctureTaken.jpg or to keep the same file name
but draw into the jpeg at the bottom right of the image the date time of the
image

everything work perfectly. My question is simple.
My original jpeg file from the camera (not modified file) is about 2 MBytes
when I open the file and draw the date time and then do save again which
include the date time in it
my file size is about 600 KBytes, I compared the 2 images, the resolution is
the same, and bit/color is the same and all the tag id are still there
however I don't understand why my new saved picture is taking only 600
KBytes. Am i loosing some date in the process ? the resulting image looks
the same as the original but somewhere something is not their anymore right
?


this my code : it;s quit simple and streight forward
DateTime myOriginDateTime = new DateTime();

myOriginDateTime = inf.DTOrig; // Here I get the original date/time of
picture taken

Image my_image = inf.Image; // This is my original picture

item.m_dtCreationTime = myOriginDateTime; // some internal logic

item.m_bDataCollected = true; // some internal logic

Graphics GraphText = Graphics.FromImage(my_image);

GraphText.CompositingQuality = CompositingQuality.HighQuality;

GraphText.SmoothingMode = SmoothingMode .HighQuality;

GraphText.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;

GraphText.InterpolationMode = InterpolationMode.HighQualityBicubic;

GraphText.PixelOffsetMode = PixelOffsetMode.HighQuality;

Brush br=new SolidBrush(m_FontColor);

Font drawFont = m_FontOption; // this is the result of a font dialog that
the user can change

String mDateTime = item.m_dtCreationTime.DayOfW+","+

mMonthOfYear[item.m_dtCreationTime.Month]+"-"+item.m_dtCreationTime.Day+"-"+

item.m_dtCreationTime.Year+" "+item.m_dtCreationTime.Hour+":"+

item.m_dtCreationTime.Minute+":"+item.m_dtCreationTime.Second;


RectangleF nRectange = new RectangleF(0, 0,my_image.Width,my_image.Height);

StringFormat drawFormat = new StringFormat();

drawFormat.Alignment = StringAlignment.Far;

drawFormat.LineAlignment = StringAlignment.Far;

GraphText.DrawString(mDateTime, drawFont, br, nRectange, drawFormat);


string szFileName = item.m_sFileName+"T";

string sNewFileName;

sNewFileName = Path.GetDirectoryName(item.m_sFileName);

sNewFileName += "\\" + "FRZ_" + Path.GetFileName(item.m_sFileName);

try

{

my_image.Save(sNewFileName);

}

catch

{

sMessage = "Error can not save to file "+ sNewFileName +"\n";

AddMessage(sMessage);

nError++;

}


any support ?

Thanks

Bassem




Report this thread to moderator Post Follow-up to this message
Old Post
Bassem Srouji
09-12-04 08:57 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Visual Studio archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:12 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.