Author Topic: save image in specified location  (Read 2903 times)

venkat0249

  • Newbie
  • *
  • Posts: 22
save image in specified location
« on: October 02, 2011, 06:06:00 PM »
i want to save canvas image in specified location. for that i used "CanvasSaveAbs" command and given file path. But still its not working. How to save that canvas image in specified folder?
Please give me an example code. I have already seen a post in this link
http://www.tigabyte.com/smf/index.php?topic=230.0
I have done as mentioned in that post, but still not working.
« Last Edit: October 02, 2011, 06:09:10 PM by venkat0249 »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 403
  • Here to help you
Re: save image in specified location
« Reply #1 on: October 04, 2011, 05:12:09 AM »
i want to save canvas image in specified location. for that i used "CanvasSaveAbs" command and given file path. But still its not working. How to save that canvas image in specified folder?
Please give me an example code. I have already seen a post in this link
http://www.tigabyte.com/smf/index.php?topic=230.0
I have done as mentioned in that post, but still not working.

I'm sorry but you have found a bug in the CanvasSaveAbs  :(

There is a work around but its not petty. Basically save your canvas to the local folder then copy it to the absolute folder.
You could put the script below into a global procedure and call it instead of calling CanvasSaveAbs.
Perhaps name the global procedure MyCanvasSaveAbs and pass the filename to it.


Code: [Select]
local ftemp,fname1,fname2,f1,f2,fx

@ 1 - Save Local
Put 'temp.jpg' into ftemp
CanvasJPEGSave(1,ftemp,100)

@ 2 - Make Local file handle f1
Put MyFolderFN into fname1
Append '\' onto fname1
Append ftemp onto fname1
FolderItemGetAbs(fname1,f1,fx,fx,fx,fx,fx)

@ 3 - Make Absolute file handle f2
Put 'C:\Documents and Settings\Administrator\My Documents\My Pictures\final.jpg' into fname2
FolderItemGetAbs(fname2,f2,fx,fx,fx,fx,fx)

@ 4 - Copy file loc to abs
FolderItemCopy(f1,f2)

@ 5 - Delete local
FolderItemDelete(f1)


NOTE, there is also a bug in the CanvasLoadAbs.
In case you need it here is a workaround:-

Code: [Select]
local fname1,fname2,fnameloc,f1,f2,fx

@ Original
Put 'C:\Documents and Settings\Administrator\My Documents\My Pictures\24072010.jpg' into fname1
FolderItemGetAbs(fname1,f1,fx,fx,fx,fx,fx)

@ Local
Put 'temp.jpg' into fnameloc
Put MyFolderFN into fname2
Append '\' onto fname2
Append fnameloc onto fname2
FolderItemGetAbs(fname2,f2,fx,fx,fx,fx,fx)

@ Copy to local
FolderItemCopy f1,f2

@ReplaceAll '\' with ':' in fname

Put fname2 into field 1

CanvasLoad(1,fnameloc,1)

I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

venkat0249

  • Newbie
  • *
  • Posts: 22
Re: save image in specified location
« Reply #2 on: October 04, 2011, 04:26:47 PM »
Yeah! its worked.... Thank you Malkom.... 8)