Copying pictures

About SheepShaver, a PPC Mac emulator for Windows, MacOS X, and Linux that can run System 7.5.3 to MacOS 9.0.4.

Moderators: Cat_7, Ronald P. Regensburg, ClockWise

hmzeuner
Space Cadet
Posts: 5
Joined: Sun Aug 15, 2021 12:51 pm

Copying pictures

Post by hmzeuner »

Since using Version 2.5 of Sheepshaver with MacOS 11.5 Big Sur, I can no longer copy diagrams generated with MacDraw Pro into applications running on Big Sur (for example MS Word shows an empty graphic object entitled "Das Bild kann nicht angezeigt werden" i.e. the picture cannot be displayed). I know that I have to move it to the clipboard by clicking into the Finder Desktop, but that does not help anymore.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Copying pictures

Post by Ronald P. Regensburg »

It worked before?
With which SheepShaver build and on which OSX/macOS host system?
hmzeuner
Space Cadet
Posts: 5
Joined: Sun Aug 15, 2021 12:51 pm

Re: Copying pictures

Post by hmzeuner »

The old Sheepshaver.app was probably Version 2.4 (2014-02-01) and the host OS was Catalina. With this combination copying of MacDraw diagrams into applications on the host worked well (except sometimes cutting off the last line of pixels). I can't run the old Version on the the new OS since Version 2.4 was 32 bit. Now in the Finder Clipboard (running under Sheepshaver Version 2.5) the copied object is denoted as "Clipboard contents: picture" and the Scrapbook says "Type: picture, dPro"
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Copying pictures

Post by Ronald P. Regensburg »

Hm, could be. The 2.4 64-bit builds had several issues and did not run on some MacOSX/OSX versions. That was the reason for the final 32-bit only 2.4 build posted in 2018, when we switched to the 2.5 versions. But, yes, since 2012 the 2.4 64-bit builds contained a solution for copying images and formatted text between guest and host that was possible in 32-bit versions and was broken in 64-bit versions. I am surprised that the February 2014 build ran on Catalina.

The 2.5 64-bit only builds are different in many ways, are build from a different source, and were the first really stable 64-bit versions that ran on all 64-bit able OSX/macOS versions. I do not know if earlier 2.5 builds can copy images between guest and host. You could try the 4 May 2019 build, but be aware that in all builds before 7 February 2021 files may loose their resource fork in Unix/shared folder on an APFS host (High Sierra and later).

It has been a long time since someone complained about not being able to copy images between guest and host. Frankly, I have not tried to do that in years. Yes, I can now confirm that it does not work. When an image is copied within SheepShaver, the host recognises that there is an image on the clipboard, but it cannot do anything with it.

I will ask the developer kanjitalk755 to have a look at this issue.

In the meantime: Can MacDraw Pro export images in a format that can be read on the macOS host side? Then you could transfer the files through Unix/shared folder. (Do not forget appropriate file name extensions.)

Another solution could be to use LibreOffice in macOS 11. LibreOffice is supposed to be able to open or import MacDraw files. You could then copy the images from LibreOffice.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Copying pictures

Post by Ronald P. Regensburg »

It does not work in older 2.5 builds either.
hmzeuner
Space Cadet
Posts: 5
Joined: Sun Aug 15, 2021 12:51 pm

Re: Copying pictures

Post by hmzeuner »

Hi Ronald,
thanks for helping with my problem even at the week end. The only other formats MacDraw can export to are PICT and PICT2; the Preview of MacOS attempts to open these files but the result does not resemble the original diagram even remotely. I also tried GraphicConverter 11 to no avail. Thanks also for the suggestion to use LibreOffice which I will install tomorrow. This approach seems very promising.
Best wishes, Hansmartin.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Copying pictures

Post by emendelson »

kanjialk755 found the answer: the Big Sur clipboard does not support the PICT format:

https://github.com/kanjitalk755/macemu/issues/102

One solution seems to be to install something like GraphicConverter (old versions are free, thanks to the author) in SheepShaver. Copy your image to the clipboard in SheepShaver, open Graphic Converter, use Cmd-J to create an image from the clipboard, and then save the image in a format like JPEG; copy the JPEG to the host and copy its contents to the clipboard there.

There must be an AppleScript-friendly way to do the, but I don't know what it is. Am I right to think that the old Mac clipboard supported only PICT images? If so, then a workaround like this seems to be the only answer.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Copying pictures

Post by Ronald P. Regensburg »

That solution will not work. Copying an image in MacOS9 puts PICT on the clipboard, regardless the original image format.

PICT images can not be opened in Big Sur either. Apple ended support for PICT format in macOS, not sure with which version (Catalina?).
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Copying pictures

Post by Ronald P. Regensburg »

Interestingly, LibreOffice can open PICT images, also in Big Sur.

Copying images in SheepShaver and pasting in LibreOffice does not work in Big Sur.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Copying pictures

Post by emendelson »

Ronald P. Regensburg wrote: Mon Aug 16, 2021 7:09 am That solution will not work. Copying an image in MacOS9 puts PICT on the clipboard, regardless the original image format.
I meant that you can install an old PPC version of GraphicConverter in SheepShaver, and use Cmd-J in SheepShaver to copy the PICT image from the clipboard into a new image file (still in SheepShaver) and then save that image file to your Unix folder in a different format so that it can be used in macOS. I did exactly that a few hours ago, so I know it works.

The old PPC version of GraphicConverter is also AppleScript-aware, and has commands to create an image from the clipboard and save the resulting image as a file, though I'm not expert enough to write the scripts correctly. So it should be possible to create an AppleScript app in SheepShaver, and running entirely in SheepShaver, that can save the PICT image in the SheepShaver clipboard to a TIFF or JPEG file in SheepShaver, and save it to the Unix folder.

I'll try again to write the AppleScript, but so far, I haven't been able to figure out how to save the image.

EDIT: And if you are very ambitious, you could save the image file into a folder inside your Unix folder, and use a Launch Daemon or Folder Action Script running in macOS to copy the contents of the image into the host clipboard automatically.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Copying pictures

Post by Ronald P. Regensburg »

emendelson wrote: Mon Aug 16, 2021 11:47 amI meant that you can install an old PPC version of GraphicConverter in SheepShaver, and use Cmd-J in SheepShaver to copy the PICT image from the clipboard into a new image file (still in SheepShaver) and then save that image file to your Unix folder in a different format so that it can be used in macOS. I did exactly that a few hours ago, so I know it works.
I misunderstood . Yes, that is a possibility.

For the OP issue, pasting MacDraw images from SheepShaver into a MS Word document on the host side, using LibreOffice as intermediate may be simpler if indeed LibreOffice can open MacDraw images.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Copying pictures

Post by mabam »

ImageMagick is a command line tool capable of converting pict.
A solution might be to create an Automator workflow that has ImageMagick convert the pict from the clipboard into e. g., tiff and copy that back to the clipboard. If you provide the workflow with its own key shortcut you can use that one instead of cmnd-V to paste the image in Big Sur.

EDIT:
Just reading emendelson’s last post. That seems a good solution to me. No need of ImageMagick which is a quite extensive suite.
Last edited by mabam on Mon Aug 16, 2021 12:29 pm, edited 1 time in total.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Copying pictures

Post by Ronald P. Regensburg »

Can ImageMagic convert the content of the clipboard?
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Copying pictures

Post by mabam »

Ronald P. Regensburg wrote: Mon Aug 16, 2021 12:28 pm Can ImageMagic convert the content of the clipboard?
No, but AppleScript or osascript can read it from there and save it to a temp file where ImageMagick can access it: https://www.oreilly.com/library/view/be ... board.html
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Copying pictures

Post by mabam »

mabam wrote: Mon Aug 16, 2021 12:24 pm EDIT:
Just reading emendelson’s last post. That seems a good solution to me. No need of ImageMagick which is a quite extensive suite.
Though an advantage using ImageMagick would be that you only need a script at the host side i.s.o. both, host and guest.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Copying pictures

Post by emendelson »

This AppleScript in SheepShaver saves the image in the SheepShaver clipboard to a PNG file in the Unix folder:

Code: Select all

tell application "Finder"
	set pngPath to "Unix:SavedPng.png"
end tell

tell application "GraphicConverter"
	activate
	new image from clipboard
	tell window 1
		save in pngPath as PNG
		close
	end tell
end tell
You could get fancy by assigning a filename to the PNG file based on the current date and time, but I haven't tried this and don't know if it's actually possible.

I'm not clear on how ImageMagick on the host would make it possible to avoid doing anything in the guest, but maybe that's because I know nothing about ImageMagick. Are there details I need to know?

EDIT: My MacOS9 app already uses a launch daemon (like a folder action script) to act on files saved to a specific folder on the host. It will be fairly easy to add a feature that automatically saves the exported image to the host clipboard. But I won’t be able to do this immediately.
Last edited by emendelson on Mon Aug 16, 2021 1:47 pm, edited 1 time in total.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Copying pictures

Post by mabam »

emendelson wrote: Mon Aug 16, 2021 1:17 pm I'm not clear on how ImageMagick on the host would make it possible to avoid doing anything in the guest, but maybe that's because I know nothing about ImageMagick. Are there details I need to know?
If I understand correctly, the PICT does arrive in the host’s clipboard (I’m not at home so I can’t test myself, though). Only the host doesn’t know what to do with it. And that’s where ImageMagick comes into play.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Copying pictures

Post by Ronald P. Regensburg »

It seems so. The macOS host is apparently aware of a bitmap image on the clipboard but it can't do anything with it. It cannot be pasted in any app, also not in an app like LibreOffice that can open pict image files. My clipboard manager does not show the image, only notes "(Image)".
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Copying pictures

Post by emendelson »

mabam wrote: Mon Aug 16, 2021 1:41 pm
emendelson wrote: Mon Aug 16, 2021 1:17 pm I'm not clear on how ImageMagick on the host would make it possible to avoid doing anything in the guest, but maybe that's because I know nothing about ImageMagick. Are there details I need to know?
If I understand correctly, the PICT does arrive in the host’s clipboard (I’m not at home so I can’t test myself, though). Only the host doesn’t know what to do with it. And that’s where ImageMagick comes into play.
The data does seem to arrive in the host clipboard, which MAY think it’s a TIFF image but I’m not sure of that. I haven’t found any app that can import the data but I don’t have ImageMagick.

EDIT: I wrote this before I saw Ronald’s post.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Copying pictures

Post by mabam »

I won’t be back home until next week so I can’t test anything for now. But I would try writing the clipboard’s content to a file using an AppleScript snippet like this:

Code: Select all

do shell script "echo \"" & the clipboard & "\" > ~/test.pict"
which will put test.pict in the user’s home folder.

For testing purposes, you could try opening it in SheepShaver by copying it via the UNIX folder. But I suppose the clipboard’s content needs some parsing first.
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Copying pictures

Post by adespoton »

Ronald P. Regensburg wrote: Mon Aug 16, 2021 1:50 pm It seems so. The macOS host is apparently aware of a bitmap image on the clipboard but it can't do anything with it. It cannot be pasted in any app, also not in an app like LibreOffice that can open pict image files. My clipboard manager does not show the image, only notes "(Image)".
Doesn't this mean that saving the clipboard to a file should result in the original PICT? Then it can be opened by any software that can read the format.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Copying pictures

Post by Ronald P. Regensburg »

Very few applications can open pict files in Big Sur (and probably in Catalina) since Apple ended support for pict. On my machine only LibreOffice can do that.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Copying pictures

Post by Ronald P. Regensburg »

mabam wrote: Mon Aug 16, 2021 2:34 pm I won’t be back home until next week so I can’t test anything for now. But I would try writing the clipboard’s content to a file using an AppleScript snippet like this:

Code: Select all

do shell script "echo \"" & the clipboard & "\" > ~/test.pict"
which will put test.pict in the user’s home folder.
I get a script error. The first part of the very long code reads:

Code: Select all

{picture:«data PICT007A0000000000FD014F001102FF0C00FFFFFFFF0000000000000000014F000000FD000000000000001E0001000A0000000000FD014F0009814224181020408000310000000000FC014E0007000000000023000000A100B6000400030003001A00000000FFFF0007000600060009FFFFFFFFFFFFFFFF003800FF», «class 8BPS»:«data 8BPS3842505300010000000000000003000000FD0000014F000800030000000000000CC03842494D03ED000000000010004800000001000100480000000100013842494D040F000000000C4800000C484C696E6F021000006D6E74725247422058595A2007CE00020009000600310000616373704D5346540000000049454320735247420000000000000000000000000000F6D6000100000000D32D485020200000000000000000000000000000000000000000000000000000000000000000000
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Copying pictures

Post by adespoton »

Ronald P. Regensburg wrote: Mon Aug 16, 2021 4:44 pm
mabam wrote: Mon Aug 16, 2021 2:34 pm I won’t be back home until next week so I can’t test anything for now. But I would try writing the clipboard’s content to a file using an AppleScript snippet like this:

Code: Select all

do shell script "echo \"" & the clipboard & "\" > ~/test.pict"
which will put test.pict in the user’s home folder.
I get a script error. The first part of the very long code reads:

Code: Select all

{picture:«data PICT007A0000000000FD014F001102FF0C00FFFFFFFF0000000000000000014F000000FD000000000000001E0001000A0000000000FD014F0009814224181020408000310000000000FC014E0007000000000023000000A100B6000400030003001A00000000FFFF0007000600060009FFFFFFFFFFFFFFFF003800FF», «class 8BPS»:«data 8BPS3842505300010000000000000003000000FD0000014F000800030000000000000CC03842494D03ED000000000010004800000001000100480000000100013842494D040F000000000C4800000C484C696E6F021000006D6E74725247422058595A2007CE00020009000600310000616373704D5346540000000049454320735247420000000000000000000000000000F6D6000100000000D32D485020200000000000000000000000000000000000000000000000000000000000000000000
What does the error say? The first part provided is definitely the header for a PICT image, the second chunk appears to be the start of the actual bitmap data.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Copying pictures

Post by Ronald P. Regensburg »

It just says "Script error" on a panel that is at first empty. After some time of beachballing the panel is finally filled with the code that is too long to be displayed.

Edit: The original is a simple 335x253 pixel image.
Post Reply