Save an image using CImage class
-
Im unable to save a image using CImage. Im able to load and draw it. At a later stage, I need to save it to a different path, so I call Save(). It gives an error '80004005' "Unspecified error". Please suggest.. TIA
The debugger is your best friend. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
The debugger is your best friend. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Just now I tried the microsoft's sample. It also gives the same error.. I have nothing to debug. The HRESULT from save is E_FAIL. thats it. the file name is valid. I also tried giving it a simple path name such as "D:\\myImg", but the same error occurs. TIA
-
Just now I tried the microsoft's sample. It also gives the same error.. I have nothing to debug. The HRESULT from save is E_FAIL. thats it. the file name is valid. I also tried giving it a simple path name such as "D:\\myImg", but the same error occurs. TIA
Does
GdiplusStartup
succeed?> The problem with computers is that they do what you tell them to do and not what you want them to do. <
-
Just now I tried the microsoft's sample. It also gives the same error.. I have nothing to debug. The HRESULT from save is E_FAIL. thats it. the file name is valid. I also tried giving it a simple path name such as "D:\\myImg", but the same error occurs. TIA
Could please post your code? :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Im unable to save a image using CImage. Im able to load and draw it. At a later stage, I need to save it to a different path, so I call Save(). It gives an error '80004005' "Unspecified error". Please suggest.. TIA
How did you try like this: m_Image.Save(_T("c:\\123\\image.jpg"));
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
Could please post your code? :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]CPallini wrote:
Could please post your code?
Hi Pallini. :-D Yeah but full code ?
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
CPallini wrote:
Could please post your code?
Hi Pallini. :-D Yeah but full code ?
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
Nope. Just the relevant one. :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Could please post your code? :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
I changed my code to use Image class. I still have the same problem. I open a image file. then try to save it in png format. Save fuction returns "Win32Error" status. GdiplusStartup is successful. What may be wrong?
Can you show your code did you attach hbitmap handle to CImage class?
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
Can you show your code did you attach hbitmap handle to CImage class?
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
Another thing I noted is that if I give only the filename.jpg or png, it saves successfully, but if I give the whole path it fails with Win32Error.
When you use of filename.jpg it uses of current directory so I think your problem is of path.
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
I changed my code to use Image class. I still have the same problem. I open a image file. then try to save it in png format. Save fuction returns "Win32Error" status. GdiplusStartup is successful. What may be wrong?
no code => no help. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Im unable to save a image using CImage. Im able to load and draw it. At a later stage, I need to save it to a different path, so I call Save(). It gives an error '80004005' "Unspecified error". Please suggest.. TIA
Hi, doesn't Save need a second parameter to tell which format to use (JPG/PNG/...)? :) Luc Pattyn [Forum Guidelines] [My Articles] I use ListBoxes for line-oriented text, and PictureBoxes for pictures, not drawings.
-
Another thing I noted is that if I give only the filename.jpg or png, it saves successfully, but if I give the whole path it fails with Win32Error.
Then probably either the path doesn't exist or you don't have sufficient rights to write to the path. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
How did you try like this: m_Image.Save(_T("c:\\123\\image.jpg"));
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
Hi, doesn't Save need a second parameter to tell which format to use (JPG/PNG/...)? :) Luc Pattyn [Forum Guidelines] [My Articles] I use ListBoxes for line-oriented text, and PictureBoxes for pictures, not drawings.
-
Then probably either the path doesn't exist or you don't have sufficient rights to write to the path. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
I have given "D:\\123\\123.png" as the path. The path exists and I have full control of the folder.
If you step into the Save method in the debugger, where is the error occurring?
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
It has a default argument. If I dont pass, it will save it in a format identified by extension.
does that mean you got it to work? if so, how? :)
Luc Pattyn [Forum Guidelines] [My Articles]
I use ListBoxes for line-oriented text, and PictureBoxes for pictures, not drawings.