Comments (18)
Using these instead works fine:
function pngpaste() {
local name="${1}"
ensure-args name @MRET
ensure isDarwin @MRET
[[ "$name" =~ '\.png$' ]] || name+=.png
osascript -e "tell application \"System Events\" to ¬
write (the clipboard as «class PNGf») to ¬
(make new file at folder \"$(pwd)\" with properties ¬
{name:\"${name}\"})"
}
function jpgpaste() {
local name="${1}"
ensure-args name @MRET
ensure isDarwin @MRET
[[ "$name" =~ '\.jpg$' ]] || name+=.jpg
osascript -e "tell application \"System Events\" to ¬
write (the clipboard as JPEG picture) to ¬
(make new file at folder \"$(pwd)\" with properties ¬
{name:\"${name}\"})"
}
Usage:
pngpaste a1.png
from pngpaste.
Interesting! Maybe there's a setting in the API that I could tweak so it doesn't mess with the contrast. Thanks for the test cases.
from pngpaste.
I ran into the same issue, but not when I pngpaste directly. Also, only when I use .png. JPEG works fine.
How to reproduce
Faulty image:
- Copy part of my screen with shift+ctrl+cmd+4
- Paste into the program "skitch"
- Copy the image in "skitch"
- pngpaste arne.png
Ok image:
- Copy part of my screen with shift+ctrl+cmd+4
- pngpaste arne.png
Almost ok image:
- Copy part of my screen with shift+ctrl+cmd+4
- Paste into the program "skitch"
- Copy the image in "skitch"
- pngpaste arne.jpeg
from pngpaste.
I have this problem, too. The pasted image looks greyed out.
from pngpaste.
This happens very badly for fullscreen screenshots. Any ideas?
from pngpaste.
Yes, the color is wrong. I need this to work for png and jpg and I need the base64 output method to pipe it back to the clipboard as base64, so I cannot use @NightMachinary's solution.
from pngpaste.
(Years later) Is this still an issue? :)
from pngpaste.
@jcsalterego Yes it is. Could you please look into it? I would really appreciate it. :)
from pngpaste.
@martin-braun are you still on
Mojave?
from pngpaste.
still/also
from pngpaste.
@jcsalterego No, I'm on Monterey at the moment. The image isn't washed out anymore, but the colors are still not correct. For instance, I copied this image:
I then run pngpaste test.png
and this is the result:
Notice how the contrast is too strong now?
Since you never touched the library and it turned around itself with the update of MacOS, I assume the original color issue was a bug in Apple's software, but is the wrong contrast at this time also Apple's fault?
from pngpaste.
@martin-braun I'm not seeing the same thing. Can you tell me how you copied the source file, and which pngpaste
command you used for the output?
from pngpaste.
@jcsalterego I copied the image via right click > copy image in Brave and I pasted with pngpaste test.png
which I installed with brew install pngpaste
.
macOS 12.6 (21G115)
Output:
from pngpaste.
@martin-braun Got it - and can you reproduce the issue in Safari? I want to rule out the source copy being the problem.
from pngpaste.
@jcsalterego You nailed it. On Safari the issue is not reproducible. I then tested to copy the image from Brave and paste it into another program, like Krita or Preview and the issue appears there as well, so it gets copied with the wrong contrast, thus it has to be a bug in Brave.
pngpaste
works fine now, so this issue can be closed.
from pngpaste.
@martin-braun Oh good, glad we tracked down the root issue.
from pngpaste.
Hey @jcsalterego, I think this issue actually still exists. It seems to have to do with the Gamma
metadata:
diff exif_orig.txt exif_pngpaste.txt
2c2
< File Name : orig.png
---
> File Name : pngpaste.png
5,7c5,7
< File Modification Date/Time : 2024:05:08 09:56:11-04:00
< File Access Date/Time : 2024:05:08 09:57:36-04:00
< File Inode Change Date/Time : 2024:05:08 09:57:34-04:00
---
> File Modification Date/Time : 2024:05:08 09:57:41-04:00
> File Access Date/Time : 2024:05:08 09:57:42-04:00
> File Inode Change Date/Time : 2024:05:08 09:57:41-04:00
19c19
< SRGB Rendering : Perceptual
---
> Gamma : 0.4545
20a21
> Color Space : sRGB
In certain viewers (like Windows Photo Viewer), the Gamma
metadata is parsed and the image will appear faded.
from pngpaste.
Related Issues (16)
- Tagging a version (for homebrew) HOT 2
- pngcopy HOT 9
- I have got an empty image with pngpaste in OSX 10.12 HOT 7
- Problem in Building! HOT 1
- Add option to output to stdout HOT 1
- paste animated gif
- State that it's for MacOS in README and description HOT 1
- gif animation HOT 3
- Allow raw binary dump HOT 2
- rosetta error: /var/db/oah..../pngpaste.aot: attachment of code signature supplement failed: 1 HOT 3
- Error: "261:313: execution error: sh: /us/local bin/pngpaste: No such file or directory (127)" HOT 4
- Does Not Build on OS X 10.9 Mavericks HOT 1
- Any chance for a jpgpaste? HOT 1
- Newer tags with lower version numbers HOT 3
- Format agnostic tool? HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pngpaste.