Tuesday, August 4, 2020

#76 2020-05-26 09:21:02 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 342

Re: I have a script to shrink pictures that stopped working under 10.15.

Must I understand that, at last, you were able to get the scripts vents to do what they are supposed to achieve or that you just got the script using ASObjC doing the job ?



Yvan not sure what you are asking here.  And not sure about it using ASObjC, I Googled it and I do not think we are using this here.  I surely never installed it.

hopefully this answers your question, what I did is I used the script Shane wrote and combined that without any changes - post number 66 and 56. That shrinks the images I drop on it in 10.15.4. 

It is a tick different in the end result compared to my old script results, but one can live with that. 

Again thanks for your help!

Offline

 

#77 2020-05-26 09:53:09 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4566

Re: I have a script to shrink pictures that stopped working under 10.15.

ChangeAgent wrote:

Must I understand that, at last, you were able to get the scripts vents to do what they are supposed to achieve or that you just got the script using ASObjC doing the job ?



Yvan not sure what you are asking here.  And not sure about it using ASObjC, I Googled it and I do not think we are using this here.  I surely never installed it.

hopefully this answers your question, what I did is I used the script Shane wrote and combined that without any changes - post number 66 and 56. That shrinks the images I drop on it in 10.15.4. 

It is a tick different in the end result compared to my old script results, but one can live with that. 

Again thanks for your help!




The script in message #56 uses ASObjC !

May you retry my scripts using Image Events after applying what Shane urged yo to do in its message #67 ?

Before doing what Shane wrote, you wrote that its script didn't worked.
I assume that doing the same for mines will give good results too.

When we work with applet/droplet we must apply Save, never rely upon the AutoSave feature.
When I face a problem with an applet or a droplet, every time I solve it with the same boring protocol:
open the applet/droplet in the Script Editor
copy all the content of the script window
delete the offending applet/droplet
paste in a new blank script window
save as an application.


To be sure, I asked peavine and he confirmed that on its side, my scripts work flawlessly under Catalina.
So they must do the same on your machine which, I assume, was not made for you with a special design.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 26 mai 2020 17:46:21

Online

 

#78 2020-05-26 11:04:01 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 342

Re: I have a script to shrink pictures that stopped working under 10.15.

=Yvan Koenig
The script in message #56 uses ASObjC !


I did not know this, I suppose it is proof of my ‘expertise’ in AS.

May you retry my scripts using Image Events after applying what Shane urged you to do in its message #67 ?


OK happy to do so.
To prevent misunderstanding, and me taking the wrong one, please be so kind and tell me what the number of the post is it is in.  Alternatively, if that is easier for you, post it again.

Before doing what Shane wrote, you wrote that its script didn't worked.
I assume that doing the same for mines will give good results too.


As I learned from you guys, it was my way of saving/copying the stuff that might have caused the problems.

When we work with applet/droplet we must apply Save, never rely upon the AutoSave feature.
When I face a problem with an applet or a droplet, every time I solve it with the same boring protocol:
open the applet/droplet in the Script Editor
copy all the content of the script window
delete the offending applet/droplet
paste in a new blank script window
save as an application.


I too know that now.  It now also explains why I have had problems in the past.  So one is never too old to learn!

So they must do the same on your machine which, I assume, was not made for you with a special design.


Not that I am aware of…

Offline

 

#79 2020-05-26 11:37:26 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4566

Re: I have a script to shrink pictures that stopped working under 10.15.

The scripts which are supposed to behave flawlessly if correctly saved as I carefully described are in message #52 and in message #55.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 26 mai 2020 19:36:47

Online

 

#80 2020-05-26 11:40:47 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 342

Re: I have a script to shrink pictures that stopped working under 10.15.

will test tomorrow when I am back at the machine.

Last edited by ChangeAgent (2020-05-26 11:41:04 am)

Offline

 

#81 2020-05-26 11:30:08 pm

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 342

Re: I have a script to shrink pictures that stopped working under 10.15.

Yvan Koenig wrote:

The scripts which are supposed to behave flawlessly if correctly saved as I carefully described are in message #52 and in message #55.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 26 mai 2020 19:36:47


Morning Yvan.

I tested the 3 scripts.  678 and 800 and 1200.  All 3 turn the icon picture 90 degrees when finished.  However, the original pic is 3.6MB, and the scripts shrink it to 2.5MB and 2.6MB and 3MB respectively.

If I change this line:

Applescript:


           scale openedFile to size 800 --<<<< here we define the wanted greater dimension

to

Applescript:


           scale openedFile to size 80 --<<<< here we define the wanted greater dimension

I get a 1MB size pic but it is now so small it is hard to see.

The one in Post 55 also works, as reported before, here too it turns the icon and the 3.6MB pic is turned in to 3.5 and 3.1 and 2.6 MB size.  And I get the dialog boxes. 

See my original script kept the picture in a workable/viewable format but shrunk its storage size.  Which is what I am after.

Offline

 

#82 2020-05-27 02:59:52 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4566

Re: I have a script to shrink pictures that stopped working under 10.15.

There is definitely a problem with your machine (or with you).

When, as you did, I drag and drop your original file :1,754,025 bytes -- 3264 x 1836 pixels, 72 DPIs
on a droplet containing the instruction: scale openedFile to size 80

I get logically a small file : 4,826 bytes -- 80 x 45 pixels, 72 DPIs

It's normal that it's a small one because the edited script asked it to return a file whose greater dimension is 80 bytes what is really done.
An other detail puzzle me: I saved two versions of the droplet.
One of them contains : save openedFile without icon
The other one contains : save openedFile with icon

The created file is the same in both cases and it has no icon.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 27 mai 2020 10:59:03

Last edited by Yvan Koenig (2020-05-27 03:00:51 am)

Online

 

#83 2020-05-27 11:45:09 pm

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 342

Re: I have a script to shrink pictures that stopped working under 10.15.

Yvan Koenig wrote:

There is definitely a problem with your machine.



I will reinstall the OS software in the next days to eliminate that one.

Last edited by ChangeAgent (2020-05-27 11:45:45 pm)

Offline

 

#84 2020-05-28 03:12:13 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4566

Re: I have a script to shrink pictures that stopped working under 10.15.

I received a new set of files.

The original file is :
4000 x 6000 pixels,  72 DPIs,
file size reported by Preview: 3,203,298 bytes,
file size reported by Finder: 3,203,298 bytes,
no resource fork.

your treated file:
53 x 80pixels, 72 DPIs,
file size reported by Preview : 2535 bytes
file size reported by Finder : 745,102 bytes
resource fork : $B54A7 bytes (the icons data)

my treated file:
53 x 80pixels, 72 DPIs,
file size reported by Preview : 2535 bytes
file size reported by Finder : 2535 bytes
no resource fork.

With these infos, things become more clear.
(1) When the inspector of Preview display a "file size", it's the size of the data fork component, not the size of the complete file.
(2) The data fork is the same in your treated file and in mine.
So, now, I know that the Image Events resizing task is correctly achieved on both machines.

It would be fine to know what is the size reported by the Finder if you apply this edited version:

Applescript:

on open draggeditems
   tell application "Image Events" to launch
   repeat with currentFile in draggeditems
       tell application "Image Events"
           set openedFile to open file (currentFile as string)
           scale openedFile to size 80 --<<<< here we define the wanted greater dimension
           save openedFile -- with icon -- <<<< don't ask for an icon
           close openedFile
       end tell
   end repeat
end open

In theory you would get:
53 x 80pixels, 72 DPIs,
file size reported by Preview : 2535 bytes
file size reported by Finder : 2535 bytes
no resource fork.

Now, the question is : why am'I not getting the resource fork describing the icons on my side ?
I will try to find what explain this behavior.
Maybe it's due to the fact that, on my machine, the Finder is set to display icons built on the fly according to the data fork content.
In the pane allowing us to rule the display of windows, the lower checkbox entitled :
"Show icon preview" is checked.
I will search if there is, somewhere, a preference preventing the system to create the resource fork supposed to store the icon.

At least, I’m reassured, the script actually works properly.

Of course, if somebody has an idea explaining why it doesn't create the resource fork on my machine, I'm all ears.

I’m a little bored to discover that the "surprising" behavior was not on your machine but on mine.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 28 mai 2020 11:09:26

Last edited by Yvan Koenig (2020-05-28 04:22:58 am)

Online

 

#85 2020-05-28 04:36:40 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 342

Re: I have a script to shrink pictures that stopped working under 10.15.

Yvan greetings.

I am presently not at the machine where I have been testing, but will as soon test the new script and report back, as soon as I have access.

You are a kind of detective eh?  Wow, what you all discovered.  What you say makes sense and is interesting to see how both OS’ behave differently.  I now also understand why it is when I pack a pic in an email that all of a sudden Outlook reports a different size.  And I am happy to hear you found it and it was not part of my stupidity.

PS for those of you reading this, Yvan and I are exchanging files via private email.  This is one of such files he refers to here.

Last edited by ChangeAgent (2020-05-28 04:38:49 am)

Offline

 

#86 2020-05-28 07:06:51 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4566

Re: I have a script to shrink pictures that stopped working under 10.15.

Late news:

under 10.9.5, the icon is created
my old 10.10 HD no longer boot
my old 10.11 HD no longer boot
under 10.12.6, the icon is not created
under 10.13.6, the icon is not created
under 10.14,  I don't know
under 10.15.4, the icon is created

As Shane Stanley wrote, maybe Apple made changed upon Image Events or the underlying framework.

Of course, I would be glad to know the behavior under 10.10, 10.11 and 10.14.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 28 mai 2020 15:06:40

Online

 

#87 2020-05-29 10:25:52 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 342

Re: I have a script to shrink pictures that stopped working under 10.15.

Yvan Koenig wrote:



With these infos, things become more clear.
(1) When the inspector of Preview display a "file size", it's the size of the data fork component, not the size of the complete file.
(2) The data fork is the same in your treated file and in mine.
So, now, I know that the Image Events resizing task is correctly achieved on both machines.

It would be fine to know what is the size reported by the Finder if you apply this edited version:

Applescript:

on open draggeditems
   tell application "Image Events" to launch
   repeat with currentFile in draggeditems
       tell application "Image Events"
           set openedFile to open file (currentFile as string)
           scale openedFile to size 80 --<<<< here we define the wanted greater dimension
           save openedFile -- with icon -- <<<< don't ask for an icon
           close openedFile
       end tell
   end repeat
end open

In theory you would get:
53 x 80pixels, 72 DPIs,
file size reported by Preview : 2535 bytes
file size reported by Finder : 2535 bytes
no resource fork.

Now, the question is : why am'I not getting the resource fork describing the icons on my side ?
I will try to find what explain this behavior.
Maybe it's due to the fact that, on my machine, the Finder is set to display icons built on the fly according to the data fork content.
In the pane allowing us to rule the display of windows, the lower checkbox entitled :
"Show icon preview" is checked.
I will search if there is, somewhere, a preference preventing the system to create the resource fork supposed to store the icon.

At least, I’m reassured, the script actually works properly.

Of course, if somebody has an idea explaining why it doesn't create the resource fork on my machine, I'm all ears.

I’m a little bored to discover that the "surprising" behavior was not on your machine but on mine.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 28 mai 2020 11:09:26



Yvan finally back at the machine and time.

The 80 makes the pic small and does not turn the icon.  3.6MB becomes 8kb

I changed the script (yes in the proper way) and one 3.6MB pic (oblong) becomes 75KB and a second (horizontal) 3.2MB > 590KB.  And the test pic I send you to becomes 74KB.

So, all in all it seems to work.

Do you know why it changes oblong pics to a different size as the horizontal pics?  If I turn the oblong to horizontal it also reduces to ±75kb while before to >±500KB.

Offline

 

#88 2020-05-29 11:31:03 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4566

Re: I have a script to shrink pictures that stopped working under 10.15.

For the orientation, I have no idea.
I'm not sure if you say that the picture and the icon are rotated or if only the icon is rotated.
Under 10.9.5 which is able to generate the icons your picture "2 copy 2.png" was "horizontal" and remained such (added icon too).
Your picture "david-pennington-T-GjUWPW-oI-unsplash copy 3" which was vertical remained vertical (added icon too).
Here are the entire results

"2 copy 2.png", no icon in the original.
originalFileSize : 1754025 bytes,    origDimensions : 3264 x 1836,    origResolution : 72,0, 72,0
required size 80    fileSize with icon : 48425 bytes,  without icon: 6033 bytes,    dimensions : 80 x 45
required size 678    fileSize with icon : 86534 bytes,  without icon: 42655 bytes,    dimensions : 678 x 381
required size 800    fileSize with icon : 105051 bytes,  without icon: 61205 bytes,    dimensions : 800 x 450
required size 1600    fileSize with icon : 296984 bytes,  without icon: 253115 bytes,    dimensions : 1600 x 900
required size 3200    fileSize with icon : 1096866 bytes,  without icon: 1053025 bytes,    dimensions : 3200 x 1800


"david-pennington-T-GjUWPW-oI-unsplash copy 3.jpg", no icon in the original.
originalFileSize : 3203298 bytes,    origDimensions : 4000 x 6000,    origResolution : 72,0, 72,0
required size 80    fileSize with icon : 51206 bytes,  without icon: 2837 bytes,    dimensions : 53 x 80
required size 678    fileSize with icon : 110795 bytes,  without icon: 61554 bytes,    dimensions : 452 x 678
required size 800    fileSize with icon : 129488 bytes,  without icon: 80325 bytes,    dimensions : 530 x 800
required size 1600    fileSize with icon : 346521 bytes,  without icon: 297378 bytes,    dimensions : 1066 x 1600
required size 3200    fileSize with icon : 1303670 bytes,  without icon: 1254536 bytes,    dimensions : 2133 x 3200

I am puzzled by a feature: For the first picture, you may see that the resource fork (the icons) is quite constant 42392 - 43879 bytes.
For the second one the range is very large : 48369 - 846129 bytes.
I have to explanation for that.

What is sure is that, when you which to reduce the file size, the first thing to do is to drop the icon. It's why on my machine, when files have a resource fork describing the icon, I remove this fork and just urge the Finder to use a preview as icon. It's a bit slower but it spare a lot of space. It may be a really useful choice on macBook with small SSD.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 29 mai 2020 19:29:53

Last edited by Yvan Koenig (2020-05-29 11:32:25 am)

Online

 

#89 2020-05-30 05:47:13 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 342

Re: I have a script to shrink pictures that stopped working under 10.15.

Indeed a bit of a conundrum.  however to drop the icon is a good one. 

and thanks again for all your caring help it is much appreciated and sorry for the occasional moment of confusion.

Offline

 

#90 2020-05-30 07:22:49 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4566

Re: I have a script to shrink pictures that stopped working under 10.15.

Don't worry.

I'm too lazy to re-boot under 10.9.5 to check but I assume that Image Events behave differently when it create the resource fork of a png file : size quite constant
and when it create it for a jpeg file : size growing with the size of the file itself.
From my point of vue the late behavior is odd.
I'm quite sure that it would be possible to drop the large resource fork from the large file and replace it by the small resource fork borrowed from the smaller file.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) samedi 30 mai 2020 15:22:43

Online

 

#91 2020-05-30 08:14:41 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 342

Re: I have a script to shrink pictures that stopped working under 10.15.

Yvan Koenig wrote:

Don't worry.


OK thanks.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)