Load JPG, rotate it, save it and then create thumb
Load JPG, rotate it, save it and then create thumb
I am using Visual FoxPro 9 and am trying to load a JPG image into the imaging control, rotate it, then save it, and finally create a thumbnail for the rotated JPG as a separate JPG in a variable size that I specify.
I have instantiated the control with the name "imageviewer". pictoedit is a string variable with the full path and filename of the JPG file.
I am loading the file with:
THISFORM.imageviewer.CreateImageFromFile(pictoedit)
Then rotating it with
thisform.imageviewer.rotate(3) (or another number depending on what the user choose to do)
Then I am trying to save the image with
THISFORM.imageviewer.SaveasJPG(pictoedit,8)
However, I get an OLE error code 0x80020006: Unknown name error.
What am I doing wrong? Then how would I go about creating a thumbnail of a maximum side of "N" pixels?
--- Martin
I have instantiated the control with the name "imageviewer". pictoedit is a string variable with the full path and filename of the JPG file.
I am loading the file with:
THISFORM.imageviewer.CreateImageFromFile(pictoedit)
Then rotating it with
thisform.imageviewer.rotate(3) (or another number depending on what the user choose to do)
Then I am trying to save the image with
THISFORM.imageviewer.SaveasJPG(pictoedit,8)
However, I get an OLE error code 0x80020006: Unknown name error.
What am I doing wrong? Then how would I go about creating a thumbnail of a maximum side of "N" pixels?
--- Martin
Re: Load JPG, rotate it, save it and then create thumb
I also tried this using
thisform.imageviewer.JPEGTransformRotate("c:\test\test.jpg","c:\test\newtest.jpg",16)
and I get the same OLE error.
-- Martin
thisform.imageviewer.JPEGTransformRotate("c:\test\test.jpg","c:\test\newtest.jpg",16)
and I get the same OLE error.
-- Martin
Re: Load JPG, rotate it, save it and then create thumb
I created a new form with a single button that contains this code:
thisform.imageviewer.JPEGTransformRotate("c:\test\test.jpg","c:\test\newtest.jpg",16)
In the form's INIT method, I put in the registration string for the control.
I still get the same OLE error.
I really need a solution to this problem.
-- Martin
thisform.imageviewer.JPEGTransformRotate("c:\test\test.jpg","c:\test\newtest.jpg",16)
In the form's INIT method, I put in the registration string for the control.
I still get the same OLE error.
I really need a solution to this problem.
-- Martin
Re: Load JPG, rotate it, save it and then create thumb
Hi Martin,
The functions you are trying to call are into the Imaging class and not into the GdViewer class. This is because you have your error message.
Just load the image into the Imaging class and do what you need with it
Best regards,
Loïc
The functions you are trying to call are into the Imaging class and not into the GdViewer class. This is because you have your error message.
Just load the image into the Imaging class and do what you need with it
Best regards,
Loïc
Re: Load JPG, rotate it, save it and then create thumb
Loïc,
If you read my first message, you can see that I am using the image control. I just gave the object a name of imageviewer, but it is the imaging control that I have loaded on the form.
-- Martin
If you read my first message, you can see that I am using the image control. I just gave the object a name of imageviewer, but it is the imaging control that I have loaded on the form.
-- Martin
Re: Load JPG, rotate it, save it and then create thumb
Sorry Martin.
The reason of your error:
There is no method JPEGTransformRotate & SaveasJPG In the Imaging class.
Try instead:
SaveAsJPEG() and TransformJPEG().
Loïc
The reason of your error:
There is no method JPEGTransformRotate & SaveasJPG In the Imaging class.
Try instead:
SaveAsJPEG() and TransformJPEG().
Loïc
Re: Load JPG, rotate it, save it and then create thumb
Thanks Loïc, I had gone back and discovered my error with the method names. It works fine now. Sorry for the inconvenience.
-- Martin
-- Martin
Re: Load JPG, rotate it, save it and then create thumb
No problem Martin !
Best regards,
Loïc
Best regards,
Loïc
Re: Load JPG, rotate it, save it and then create thumb
Loïc,
Will the transformJPEG method allow you to losslessly rotate a file to the same name?
as in:
object.transformJPEG("myfile.jpg","myfile.jpg",13)
-- Martin
Will the transformJPEG method allow you to losslessly rotate a file to the same name?
as in:
object.transformJPEG("myfile.jpg","myfile.jpg",13)
-- Martin
Re: Load JPG, rotate it, save it and then create thumb
One more question.
I have a form with an imaging control and a viewer, and a radio button that lets the user choose what rotation to use for a group of files that was previously selected.
I want to be able to display in the viewer control each file as it is rotated, both before and after it is rotated, and I want to rotate losslessly using transformJPEG().
Right now, I load the JPG image into the imaging control, and then load the viewer from the imaging control. Then I call the transformJPEG to rotate the image, and then I re-load it into the image control and then to the viewer.
At that point I need to create a thumbnail file of the image of a size that is stored in my program. I have previously stored the height and width and adjusted those based on how it was rotated, so it should not be hard to do this from the imaging control with a resize, but it seems like I am doing too many reads and writes to accomplish this task. Basically all I want to do is losslessly rotate the images, but I would like to display what is going on if it won't slow things down too much.
Is there a better way to accomplish this?
-- Martin
I have a form with an imaging control and a viewer, and a radio button that lets the user choose what rotation to use for a group of files that was previously selected.
I want to be able to display in the viewer control each file as it is rotated, both before and after it is rotated, and I want to rotate losslessly using transformJPEG().
Right now, I load the JPG image into the imaging control, and then load the viewer from the imaging control. Then I call the transformJPEG to rotate the image, and then I re-load it into the image control and then to the viewer.
At that point I need to create a thumbnail file of the image of a size that is stored in my program. I have previously stored the height and width and adjusted those based on how it was rotated, so it should not be hard to do this from the imaging control with a resize, but it seems like I am doing too many reads and writes to accomplish this task. Basically all I want to do is losslessly rotate the images, but I would like to display what is going on if it won't slow things down too much.
Is there a better way to accomplish this?
-- Martin
Re: Load JPG, rotate it, save it and then create thumb
I figured out a better way that should have very little overhead. After I rotate the image in the imaging control, I rotate it by the same amount in the viewer control. That way I don't have to go back to the disk at all. Works well, and does not seem to have much overhead at all.
-- Martin
-- Martin
Re: Load JPG, rotate it, save it and then create thumb
Do you know if there is a load blob picture data directly to the control using VFP? I have the picture in the blob field and I will have to create a temp file using strtofile to use DisplayFromFile method. I am wondering if we can somehow utilize any other method using the binary string with data from the blob field?
Who is online
Users browsing this forum: No registered users and 1 guest