Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
hi all
as a matter of fact I'm writing an image processing app by c#.net.
here I make an image based on the other image .
it means that "I have an image and I make some changes on it and save it again" but the problem is "the thumbnail of image doesn't change" . very simple code like this :
 
string strPath="c:\\bb.jpg",strMainPicPath="c:\\aa.jpg" ;
Image imgBase;
imgBase = Image.FromFile(strMainPicPath);
 
SolidBrush brush = new SolidBrush(cWhite);
Font fntB = new Font("tahoma", 8, FontStyle.Bold);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(imgBase);
g.DrawString("Test String", fntB, brush, 100, 100);
g.Dispose();
 
imgBase.Save(strPath, System.Drawing.Imaging.ImageFormat.Jpeg);
imgBase.Dispose();
 
problem is just thumbnail of image .
Posted 4-Aug-12 5:29am
Max110504
Edited 4-Aug-12 5:32am
v2
Comments
Wes Aday at 4-Aug-12 10:39am
   
Since you are not creating a thumbnail of your image how do you expect it to change?
OriginalGriff at 4-Aug-12 10:59am
   
I assume he means the folder thumbs.db cache, but it's fine on mine...
Max110 at 4-Aug-12 14:19pm
   
it is not about folder or such external things . it's about in-image .
Wes Adey , how I should make thumbnail for an image file .just watch this screen shot to know more about my problem .(http://darion.ir/max/ex.jpg) in this window I selected 3rd image and windows shows the preview of image above . just watch , there is nothing in Icon (thumbnail) but lots of things in image !?
OriginalGriff at 4-Aug-12 10:58am
   
At first I assumed that this meant that the thumbs.db cache was not being updated, but I tried it on my system, just changing the paths in your code to a temporary folder with some images in it, and it worked fine.
What are you doing that I'm not, or vice versa?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

This is pretty bad code. Always use the using construct to force things to be disposed. As others have said, if you change your image, you also need to generate a new thumbnail, that seems obvious.
  Permalink  
Comments
Max110 at 5-Aug-12 2:02am
   
and your answer pretty useless one :D
if I knew how to generate a new thumbnail I didn't ask here . I searched web for some hours and couldn't find good solution for that . if u have a good way to generate new thumbnail I'm a good student for your teach.
Christian Graus at 5-Aug-12 2:03am
   
Your question is useless :-) Where does your 'thumbnail' come from if you don't generate it ? If you mean the thumbnails windows generates, delete the thumbs.db file to force them to regenerate. If not, then you can pass your image in to a Bitmap constructor with a smaller size, to create a thumbnail.
Max110 at 16-Aug-12 6:08am
   
maybe I can't explain my problem . I use a pure photo and put lots of graphics on it . them I save it . but the problem is saved image don't show new graphics in it's own thumbnail . when I save it by photoshop again photo become standard but I don't want to do that . and I don't want to have new photos as thumbnails.
the problem is just with one photo and it's own thumbnail !
Christian Graus at 16-Aug-12 11:32am
   
You have the answer. The system thumbnails is in the thumbs.db file, delete it to regenerate that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Mathew Soji 330
1 BillWoodruff 260
2 Sergey Alexandrovich Kryukov 240
3 OriginalGriff 216
4 Afzaal Ahmad Zeeshan 208
0 OriginalGriff 6,168
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,028
3 Manas Bhardwaj 4,539
4 Maciej Los 3,845


Advertise | Privacy | Mobile
Web01 | 2.8.1411019.1 | Last Updated 4 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100