• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Color Conversion Gone Bad in Mavericks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Color Conversion Gone Bad in Mavericks


  • Subject: Re: Color Conversion Gone Bad in Mavericks
  • From: Shane Stanley <email@hidden>
  • Date: Thu, 20 Feb 2014 17:58:23 +1100

On 20 Feb 2014, at 5:30 pm, Håvard Graudo <email@hidden> wrote:

I've seen that too. Yellow turns blue etc...

My workaround was to do only one command in each line:

This fails and gives horrible colours on 10.9 (OK with 10.8 and lower):
sips --resampleHeightWidthMax 300 -s format png '/Library/Audio/MIDI Devices/Generic/Images/DrumMachine.pdf' --out sipsbugone.png

Workaround on 10.9:
sips  -s format png '/Library/Audio/MIDI Devices/Generic/Images/DrumMachine.pdf' --out sipsbugtwo.png
sips  --resampleHeightWidthMax 300 sipsbugtwo.png --out sipsbugthree.png

Filed a bug with Apple a month ago: 15878440

It may be related, but it looks like a different bug. At any rate, trying your workaround and doing just the resize, with input and output formats (.pdf) the same:

do shell script "sips  -z 2550 3300" & " " & posixInput & " --out " & posixOutput

still produces the same problem here. So it looks like there is some size threshold.

FWIW, an alternative is use an ASObjC-based script library handler, like this:

on jpegFromPath:imagePath toPath:newPath newWidth:theWidth newHeight:theHeight compressFactor:compFactor
set theImage to current application's NSImage's alloc()'s initWithContentsOfFile:imagePath -- load the file as an NSImage
set newImage to current application's NSImage's alloc()'s initWithSize:(current application's NSMakeSize(theWidth, theHeight)) -- make new blank image of target size
-- draw from original to new
newImage's lockFocus()
theImage's drawInRect:{origin:{x:0, y:0}, |size|:{width:theWidth, height:theHeight}} fromRect:(current application's NSZeroRect) operation:(current application's NSCompositeSourceOver) fraction:1.0
newImage's unlockFocus()
set theData to newImage's TIFFRepresentation() -- get bitmap as data
set newRep to current application's NSBitmapImageRep's imageRepWithData:theData -- make bitmap from data
set theData to (newRep's representationUsingType:(current application's NSJPEGFileType) |properties|:{NSImageCompressionFactor:compFactor, NSImageProgressive:false}) -- turn the bitmap into JPEG data
(theData's writeToFile:newPath atomically:true) -- write it to disk
end jpegFromPath:toPath:newWidth:newHeight:compressFactor:

The catch is that it might be a bit harder to use from FileMaker -- it may need to be called by an external script.

Meanwhile it would probably be worth logging another bug on sips.

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Color Conversion Gone Bad in Mavericks
      • From: Shane Stanley <email@hidden>
References: 
 >Color Conversion Gone Bad in Mavericks (From: Jon Rosen <email@hidden>)
 >Re: Color Conversion Gone Bad in Mavericks (From: Håvard Graudo <email@hidden>)

  • Prev by Date: Re: Color Conversion Gone Bad in Mavericks
  • Next by Date: Re: Color Conversion Gone Bad in Mavericks
  • Previous by thread: Re: Color Conversion Gone Bad in Mavericks
  • Next by thread: Re: Color Conversion Gone Bad in Mavericks
  • Index(es):
    • Date
    • Thread