node-pngdefry
node-pngdefry copied to clipboard
Getting error when trying to run pngdefry
I've installed this and tried to run it, but I keep getting this error:
Hi, coming from your reddit post.
Unfortunately, I haven't used this project, but I might have some idea why it's not working for you.
Can you check whether you have a file named pngdefry under the underlined path?
I think this is the problem - the code looks for a pngdefry binary under this path, but I think this package is no longer installing it for you at this path.
Not sure how to fix this, maybe you need to find the original binary and put it into said path.
Hi, coming from your reddit post.
Unfortunately, I haven't used this project, but I might have some idea why it's not working for you.
Can you check whether you have a file named
pngdefryunder the underlined path?I think this is the problem - the code looks for a
pngdefrybinary under this path, but I think this package is no longer installing it for you at this path.Not sure how to fix this, maybe you need to find the original binary and put it into said path.
ohh hm i actually dont. i only have C:\Users\Admin\AppData\Roaming\npm\node_modules\pngdefry\lib\pngdefry\bin\osx\pngdefry
no \bin\windows\pngdefry
so i created \windows and copied the pngdefry binary from the osx folder in there, but when i run the command again, it says this now:
Hi, coming from your reddit post. Unfortunately, I haven't used this project, but I might have some idea why it's not working for you. Can you check whether you have a file named
pngdefryunder the underlined path?I think this is the problem - the code looks for a
pngdefrybinary under this path, but I think this package is no longer installing it for you at this path. Not sure how to fix this, maybe you need to find the original binary and put it into said path.ohh hm i actually dont. i only have
C:\Users\Admin\AppData\Roaming\npm\node_modules\pngdefry\lib\pngdefry\bin\osx\pngdefryno\bin\windows\pngdefryso i created
\windowsand copied the pngdefry binary from the osx folder in there, but when i run the command again, it says this now:
Well, OSX binary won't work on Windows, they're not compatible.
I think the only way is to compile the binary on windows and put the executable in the mentioned path.
I think this is using this binary: https://github.com/esjeon/pngdefry
Hi, coming from your reddit post. Unfortunately, I haven't used this project, but I might have some idea why it's not working for you. Can you check whether you have a file named
pngdefryunder the underlined path?I think this is the problem - the code looks for a
pngdefrybinary under this path, but I think this package is no longer installing it for you at this path. Not sure how to fix this, maybe you need to find the original binary and put it into said path.ohh hm i actually dont. i only have
C:\Users\Admin\AppData\Roaming\npm\node_modules\pngdefry\lib\pngdefry\bin\osx\pngdefryno\bin\windows\pngdefryso i created\windowsand copied the pngdefry binary from the osx folder in there, but when i run the command again, it says this now:Well, OSX binary won't work on Windows, they're not compatible.
I think the only way is to compile the binary on windows and put the executable in the mentioned path.
I think this is using this binary: https://github.com/esjeon/pngdefry
I don't understand this one too hahah, how do I compile the binary for this one? I tried cc pngdefry.c and pngdefry.c with no luck
@korboybeats I had no problem compiling the pngdefry, but I'm on macOS.
Running cc pngdefry.c created an executable a.out (default name if not provided) which responds with such usage message
Do you have a C compiler installed on your machine?
Maybe this tutorial will help: https://www.wikihow.com/Run-C-Program-in-Command-Prompt
@arkus7
Alright so I installed a C compiler and just tried it again, but it just outputted a wall of errors
Will the binary you compiled work for me?
@korboybeats No, as mentioned above, I'm on macOS - the binary is not compatible with Windows.
Did you try running another program with a similar purpose, e.g. https://axelbrz.com/?mod=iphone-png-images-normalizer or https://gist.github.com/urielka/3609051
@arkus7 so I tried the ipin.py thing but getting an error for that as well. I will just give up on it lol, I really appreciate your help man
@korboybeats I might try to compile it on Windows when I get a chance to work on such platform, but cannot guarantee when
@korboybeats ok, I think good news, I managed to compile it on Windows.
It wasn't as straightforward as on macOS, but it works :P
Steps to fix:
- Download the newest version of
minizfrom here as a zip package - Replace the original
miniz.cfile with theminiz.cfile from the zip above - Try to compile (
gcc -o pngdefry.exe pngdefry.c). If it works, great! DONE! Otherwise, continue. - If you have an error like
undefined reference to '_ftelli64', open theminiz.cfile and replace all occurrences (there were 2 for me for each word) of_ftelli64withftelland_fseeki64withfseek(found it here) - It should compile now.
Here's the updated pngdefry repo contents with the changes above and compiled binary. You're running the prebuilt binary at your own risk. I'm not a harmful person, but should you trust a random guy on the internet?
Try to build it yourself with the steps above, then you have the most chance it would work on your machine.
@arkus7 Damnnnn you're a god. I managed to get the binary compiled, but.. lmao now when I try pngdefry -i icon.png -o new.png I get this error:
@korboybeats Check the help message of pngdefry, the -i option for pngdefry has a different meaning than -i for node-pngdefry
In node-pngdefry the -i option means input file, but in pngdefry it specifies max IDAT chunk size in bytes (whatever this means 😅)
PNGdefry version 1.1 by [Jongware], 21-Jan-2012
Removes -iphone specific data chunk, reverses colors from BGRA to RGBA, and de-multiplies alpha
usage: pngdefry [-soaplvid] file.png [...]
Options: - use this if your first input file starts with an '-' -s(suffix) append suffix to output file name -o(path) write output file(s) to path Note: without -s or -o, NO output will be created. -a do NOT de-multiply alpha -l list all chunks -v verbose processing -i(value) max IDAT chunk size in bytes (minimum: 1024; default: 524288) -p process all files, not just -iphone ones (for debugging purposed only) -d very verbose processing (for debugging purposes only)
If you're calling pngdefry directly, you should call it like this
pngdefry -o new.png icon.png
@arkus7 ahh i see, my bad. But now getting yet again, another issue lmao
I don't think it wants to work for me lol
@korboybeats Ok, I think I misunderstood how this works, maybe create a new folder where the outputs should land like out and instead new.png pass out
pngdefry -o out icon.png
Unfortunately, I don't have any file that is crushed, so I can't test it on my setup.
@korboybeats Ok, I think I misunderstood how this works, maybe create a new folder where the outputs should land like
outand insteadnew.pngpassoutpngdefry -o out icon.pngUnfortunately, I don't have any file that is crushed, so I can't test it on my setup.
YESSSS IT WORKED
Thank you so much man. I really appreciate it 🙏🙏
No problem, happy it worked!

