Comments (8)
Hi, I’m not sure what’s the issue. Is it the cgbi in zip archive cannot be converted to png?
from cgbi-to-png.
The test code is
const cgbiToPng = require('cgbi-to-png');
const fs = require('fs');
var cgbiBuffer = fs.readFileSync('./AppIcon.png');
var pngBuffer = cgbiToPng.revert(cgbiBuffer);
fs.writeFile('target.png', pngBuffer, function(err) {
if(err) {
return console.log(err);
}
console.log('The file was saved!');
});
from cgbi-to-png.
Hi, does this problem have a solution?
from cgbi-to-png.
Hi @JChord sorry for the delay. I can reproduce this in tests, also checked the PNG and script logging. The difference I've noticed is that png you provided has iCCP colour profile, which could be cause of the problem. Do you know the xcode version that generated the ipa file? It's also lighter than the test file:
AppIcon.png:
chunk type (start: 8)
chunk type (end: 23): CgBI
chunk type (start: 24)
chunk type (end: 48): IHDR
chunk type (start: 49)
chunk type (end: 2626): iCCP
chunk type (start: 2627)
chunk type (end: 19085): IDAT
chunk type (start: 19086)
chunk type (end: 19097): IEND
Test png file:
chunk type (start: 8)
chunk type (end: 23): CgBI
chunk type (start: 24)
chunk type (end: 48): IHDR
chunk type (start: 49)
chunk type (end: 64): gAMA
chunk type (start: 65)
chunk type (end: 77): sRGB
chunk type (start: 78)
chunk type (end: 121): cHRM
chunk type (start: 122)
chunk type (end: 478): iTXt
chunk type (start: 479)
chunk type (end: 499): pHYs
chunk type (start: 500)
chunk type (end: 539): iDOT
chunk type (start: 540)
chunk type (end: 19667): IDAT
chunk type (start: 19668)
chunk type (end: 38484): IDAT
chunk type (start: 38485)
chunk type (end: 38496): IEND
AppIcon.png after exporting it from macos preview app:
chunk type (start: 8)
chunk type (end: 32): IHDR
chunk type (start: 33)
chunk type (end: 2616): iCCP
chunk type (start: 2617)
chunk type (end: 2973): iTXt
chunk type (start: 2974)
chunk type (end: 19369): IDAT
chunk type (start: 19370)
chunk type (end: 24060): IDAT
chunk type (start: 24061)
chunk type (end: 24072): IEND
Exported output from AppIcon.png using library:
chunk type (start: 8)
chunk type (end: 32): IHDR
chunk type (start: 33)
chunk type (end: 2610): iCCP
chunk type (start: 2611)
chunk type (end: 21849): IDAT
chunk type (start: 21850)
chunk type (end: 21861): IEND
Also could you provide original png file from project sources?
from cgbi-to-png.
The best guess right now is the difference in iCCP format of IDAT package. The script (rewritten from python) "shuffles" back the RGB values (they are in reverse order in cgbi) which is correct way for sRGB, but may not be correct for iCCP.
from cgbi-to-png.
@jakubknejzlik I get this issue too. Can this problem be solved?
Here is the original png file: png file
from cgbi-to-png.
Hi @chenquincy, thanks for your report. Unfortunately I currently don't have time budget to investigate this issue, but pull requests are always welcome.
from cgbi-to-png.
Both failed images are interlaced. So it looks like interlaced images are not yet supported at this moment, the row lengths are not necessary 1 + width*4 in them as the pixels are rearranged.
Also, in the code the image is assumed to be 8bit RGBA, i have no idea what types are really supported in that Apple's proprietary format, R/B channels swap should not happen for some kind of the images (for instance, for grayscale).
from cgbi-to-png.
Related Issues (3)
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 cgbi-to-png.