Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPG (Image file format - add Reader ?) #71

Open
longde123 opened this issue Mar 22, 2018 · 2 comments
Open

JPG (Image file format - add Reader ?) #71

longde123 opened this issue Mar 22, 2018 · 2 comments

Comments

@longde123
Copy link

https://github.com/HeapsIO/heaps/blob/master/hxd/res/NanoJpeg.hx

@ncannasse
Copy link
Member

ncannasse commented Mar 22, 2018 via email

@nanjizal
Copy link

I have rearranged the code and put it in my folder project, see reader here format.jpg.Reader.hx.
folder is already set to help with loading images and it was easy accomodate JPG.

The reader is able to detect progressive JPG's fine ( we can't use them ).

And it Compiles on Neko and C++. which is a good start.

On C++ the pixels seem to be empty :( shame.

Runtime on Neko I get:
Called from format.jpg.Reader::upsampleV line 547
Uncaught exception - Invalid operation (*)

Test code

package;
import hxPixels.Pixels; // https://github.com/azrafe7/hxPixels
import folder.Folder;
class Main{
    var folder = new Folder();
    static function main(){ new Main(); } public function new(){
        var images = folder.getImages( './' );
        var fileName = 'TestImage.png';
        for( img in images ) if( img.fileSpec.name == fileName ) pixels = img.pixels;
        var w = pixels.width;
        var h = pixels.height;
        for( x in 0...w ) for( y in 0...h ) trace( pixels.getPixel32( x, y ) );
    }
}

compile code

-cp src
-main Main
-neko main.n
#-cpp main
-lib folder
-lib hxPixels
-lib format
#-debug
-cmd neko main.n 

Do you have some good test images, I modified largest "RIP.jpg" from online wikipedia but it was progressive so modified in Krita, but I am unsure if it's an ideal representative jpg. If you have test samples jpg that would help. I am not really very knowledgable in debugging neko / c++, I can try but advise welcome, if you get a chance to take a quick look or send me your test jpgs, if we get this working what else is need prior to pull?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants