Hi,
REALbasic 5.5.5 _AND_ REALbasic 2005r4:
Mac OS X 10.3.9
the following code returns:
<start>
Error in the save operation
Unable to save the image file.
The error code is: 101.
<end>
THE SAVED IMAGE FILE IS THERE AND VALID!
Original file: 13.844 Bytes (GIF)
Just Saved file: 14.456 Bytes (JPEG)
It loads fine in Preview and in the generated application.
WHY ?
BTW: the problem _LIES_ in the SaveAsJPEG code (or in the call that SaveAsJPEG
do; to QuickTime ?). When I replace "SaveFI.SaveAsJPEG" by
"SaveFI.SaveAsPicture", the file is saved and no error is generated.
Poor Linux user, as far as REALbasic 2005r4, SaveAsJPG needs QuickTime...
[use BMP or a PlugIn]
FolderItem.SaveAsPicture Method:
It does not adds an extension (FolderItem.SaveAsJPEG have the same behavior: do
not adds an extension) and therefore, the Finder thinks that this is a...
SimpleText document (due to QuickTime ?): AppleScript reports: file type:
"PICT", creator type: "ttxt" (ttxt = SimpleText).
Weird.
Emile
Code in the Save As Menu Handler:
//
// Save the image As...
//
Dim SaveDlg As New SaveAsDialog
Dim SaveFI As FolderItem
Dim SaveErrorCode As Integer
Dim SaveErrorHead As String
// Fills the "Method" header string
SaveErrorHead = "Error in the save operation" + EndOfLine + EndOfLine
// Check if the Canvas Backdrop is Nil (and stop otherwise continue)
If cImg.Backdrop = Nil Then
MsgBox SaveErrorHead + "Sorry, but there is no image to save."
Return False
End If
// Set some properties
SaveDlg.InitialDirectory = GetFolderItem("Documents")
SaveDlg.SuggestedFileName = "My nice Image.jpg"
// Show the Save dialog
SaveFI = SaveDlg.ShowModal()
If SaveFI = Nil Then
// User canceled: no need to tell what happens...
Return False
End If
// Save the image
SaveFI.SaveAsJPEG cImg.Backdrop // The image is stored there...
// Check for the save status
// a. Get the Error Code
SaveErrorCode = SaveFI.LastErrorCode
If SaveErrorCode <> 0 Then
MsgBox SaveErrorHead + "Unable to save the image file." + EndOfLine +
EndOfLine +_
"The error code is: " + Str(SaveErrorCode) + "."
End If
PS: in fact, but this is inherent to the JPEG format, the original file is
better than the saved file. The saved file have image noise due to the
destructive compress sheme of the JPEG format. The test file is a Rolling Stones
tongue (gold) and I have loaded it in a Canvas with a light cyan background and
the image is passed as Transparent. So I am able to see the image noise around
the tongue. The shade of gold are not as good as in the original image too.
This have nothing to do with the error "101 - File Not Found"...
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>