|
Interesting.
You found a propertyitem id indicating thumbnail data on the saved image?
The code is at home and I am at work so I can't give you more details until later. But I don't think there was much to it. It was something like:
Image myImage = Image.LoadFromFile("test.jpg");
myImage.Save("test_new.jpg"); and myImage.Save("test_new.jpg",ImageFormat.jpeg);
Both calls lost the propertyid items related to thumbnails.
I can post the exact code tonight.
David
|
|
|
|
|
dsweet wrote:
You found a propertyitem id indicating thumbnail data on the saved image?
Yep, I've uploaded the source to my test program. It has no error checking, so you need to follow the order correctly First load the image, then load the attributes; double click on the thumbnail data (has ~4K of data with it) to view the thumbnail; then click save to have it save the image as C:\test2.jpg.
Here is a test image to use for it if you don't have one with thumbnails...test.JPG (820.8 Kb)
James
|
|
|
|
|
Thanks a lot! I will run it on my PC tonight and see if I get the same results.
David
|
|
|
|
|
Bad News (for me).
The code you sent me did not produce the same results.
After saving test2.jpg and then reloading it, the tag (20507) was gone!
Do I need a new version or something?
Help-About states that I have .net framework 1.0.3705. What are you using?
David
|
|
|
|
|
Wow, this is too weird.... What OS are you on?
I'm running XP Pro with all the latest updates. I'll try my 2k server box in a second.
James
|
|
|
|
|
Ok, just tried it on my 2k box and it is missing the thumbnail data. I think this qualifies for bug material.
Can anyone confirm what happens on 98/ME/NT4/XP Home? Follow the directions in this post.
James
|
|
|
|
|
Running winver I get :windows 2000 ver 5.0(build 2195: Service Pack 2)
.net framework: ver 1.0.3705.
No thumbnails.
|
|
|
|
|
On NT 4.0 sp6a there are no thumbnails either.
|
|
|
|
|
Erick Ellis (MS) suggested installing this QFE.
Backup the gdiplus.dll in your %WINDIR%\Microsoft.NET\v1.0.3705\ .
Now since the QFE is made for Windows XP you'll need to use Winzip to extract the files. Then place the new gdiplus.dll in the v1.0.3705 directory.
I'm hoping this is just a temporary fix until the updated gdiplus.dll is included with .NET SP2.
James
|
|
|
|
|
That worked on my NT system here at work.
Thanks for your help.
David
|
|
|
|
|
I'm not sure why these functions were not included in the .NET release, they seem pretty important to me. They may be posted elsewhere, but I couldn't find them. I coded up these two functions (in C#), which I think should be public knowledge and this is the best place I could think of to post them. If you have any feedback, please reply.
---
// Time as represented by 32 (unsigned) bits is generally
// the number of seconds since midnight 01/01/1900.
// 1 tick = 100 nanoseconds ... 1 second = 10,000,000 ticks
static void ConvertInt32ToDateTime(UInt32 time32Bit, out DateTime time64bit)
{
// Convert an UInt32 representing seconds to an
// Int64 representing Timespan ticks
Int64 tempTimeSpan = Convert.ToInt64(time32Bit) * 10000000;
TimeSpan time32BitAsTimeSpan = new TimeSpan(tempTimeSpan);
DateTime baseTime32Bit = new DateTime(1900, 1, 1, 0, 0, 0);
time64bit = baseTime32Bit + time32BitAsTimeSpan;
}
static void ConvertDateTimeToInt32(DateTime time64bit, out UInt32 time32Bit)
{
DateTime baseTime32Bit = new DateTime(1900, 1, 1, 0, 0, 0);
TimeSpan time32BitAsTimeSpan = time64bit - baseTime32Bit;
time32Bit = Convert.ToUInt32(time32BitAsTimeSpan.TotalSeconds);
}
---
Thanks.
-Michael M
|
|
|
|
|
Hi,
This may be very easy question but i am new to c#.
I want to read the file from start to end line by line,my code is:
FileStream myFileStream = new FileStream("temp.txt" , FileMode.Open , FileAccess.Read);
myFileStream.Seek(0, SeekOrigin.Begin);
StreamReader myReader = new StreamReader(myFileStream);
while(??)
{
myReader.ReadLine();
}
What is the equivalent of EOF here.I want to read each line upto the End of File is reached,how should i do that?
Thanx n Regards
Tushar
|
|
|
|
|
I've not test this,but I think thats what you want.(its from MSDN)
StreamReader srReadLine = new StreamReader(
(System.IO.Stream)File.OpenRead("C:\\Temp\\Test.txt"),
System.Text.Encoding.ASCII);
srReadLine.BaseStream.Seek(0, SeekOrigin.Begin);
while (srReadLine.Peek() > -1) {
Console.WriteLine(srReadLine.ReadLine());
}
srReadLine.Close();
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
Tushar mahajan wrote:
while(??)
{
myReader.ReadLine();
}
change that code to:
string line = "";
while(line != null)
{
if(line != null)
{
line = myReader.ReadLine();
}
}
When you reach the end of file ReadLine retunrns null
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
Isn't the if (line != null) superfluous ?
Crivo
Automated Credit Assessment
|
|
|
|
|
Nope, It will throw an exception if you don't check line if it's null.
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
That's not true. Probably, what you whant is this:
string line = "";
while(line != null)
{
line = myReader.ReadLine();
if(line != null)
{
}
}
Crivo
Automated Credit Assessment
|
|
|
|
|
Ofcourse will ReadLine not be inside the if statement!!
I did a little misstake there!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
I don't know about you, but I never made a program that worked in the 1st try. No matter how simple, sometimes it doesn't compile. If it compiles, it doesn't run.
Crivo
Automated Credit Assessment
|
|
|
|
|
You're right!
But I've done that stuff so that's why I -->
Bye!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
im trying to draw a line in autocad. i copied the code directly from the liteture. but i recived this error "undeclared identifier" here is my code
//
// ObjectARX defined commands
#include "StdAfx.h"
#include "StdArx.h"
// This is command 'CREATLINE'
void RBH1creatLine()
{
AcGePoint3d startPt (4.0, 2.0 ,0.0);
AcGePoint3d endPt (10.0, 7.0, 0.0);
AcDbLine *pLine = new AcDbLine (startPt, endPt);
AcDbBlockTable * pBlockTable;
acdbHostApplicationServices()->workingDatabase()->getSymbolTable( pBlockTable, AcDb::kForRead);
AcDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);
pBlockTable->close();
AcDbObjectId lineId;
pBlockTableRecord->appendAcDbEntity(lineId, pLine);
pBlockTableRecord->close();
pLine->close();
return lineId;
}
could you please give me a hand
Richard
|
|
|
|
|
You might try in the C++ forum, instead of the C# forum
What identifier is undeclared?
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi all
I have the following line of code
System.Array myValues = (System.Array)range.Cells.Value;
how can I convert the myValues array to string array?????
Thanks in Advance
|
|
|
|
|
Have you tried this:
System.Array myValues = (System.Array)range.Cells.Value;
myValues = (string [])myValues;
Nick Parker
|
|
|
|
|
yes Idid but it didn't work
What I did is I wrote a function that takes a System.Array variable as a parameter and returns a String[] array by converting the elements one by one.
it works but I would like to if there is a function to do that in one line of code.
|
|
|
|