GithubHelp home page GithubHelp logo

STBI Exception about flippy HOT 5 CLOSED

treeform avatar treeform commented on July 27, 2024
STBI Exception

from flippy.

Comments (5)

treeform avatar treeform commented on July 27, 2024

I usually get that error from STBI when I supply the wrong path. Are you sure you can open the file?

discard readFile("C:\\Nim\\NimExamples\\MyRecipes\\a.png") work?

Are you sure its a png file? STBI can't open some png files what are odd like monochrome ...

Does it work with png files in the test folder?

from flippy.

EasiestSoft avatar EasiestSoft commented on July 27, 2024

The same exception accurred on Windows 10 (64):
Nim Compiler Version 1.0.4 [Windows: i386]
MinGW32 from Nim official site

Tested with fillCirle.png in the test folder and made sure the path was correct by:
doAssert img.fileExists

May be a link issue:

https://gitlab.com/define-private-public/stb_image-Nim/issues/8

from flippy.

EasiestSoft avatar EasiestSoft commented on July 27, 2024

This issue can be solved by adding cdecl to stb_... procs:

# Internal functions
proc stbi_write_png(
  filename: cstring;
  w, h, comp: cint;
  data: pointer,
  stride_in_bytes: int
): cint
  {.importc: "stbi_write_png",cdecl.}

As jangko said on Nim forum:

depends on your C compiler configuration, most of the times you need to specify the calling convention explicitly, for example: stdcall for msvc or cdecl for gcc

in your case, try add cdecl:

proc addTwoIntegers(a, b: cint): cint {.importc,cdecl.}

from flippy.

treeform avatar treeform commented on July 27, 2024

I switched to using https://github.com/jangko/nimPNG which has no C code.
Does this work for you now?

from flippy.

EasiestSoft avatar EasiestSoft commented on July 27, 2024

The nimPNG based version of flippy works for me and now it supports Unicode file names on Windows(Using MinGW)

from flippy.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.