Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6725725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:50:30+00:00 2026-05-26T09:50:30+00:00

I am using ImageMagick library with Python ctypes . I wrote a following simple

  • 0

I am using ImageMagick library with Python ctypes. I wrote a following simple code, but it crashes with segmentation fault (KERN_INVALID_ADDRESS) in Mac:

from ctypes import *
from ctypes.util import find_library

lib = CDLL(find_library('MagickWand'))
lib.MagickWandGenesis()
wand = lib.NewMagickWand()
lib.MagickReadImage(wand, 'mona-lisa.jpg')
lib.DestroyMagickWand(wand)
lib.MagickWandTerminus()

It works well in Linux and Windows both, but craches only in Mac OS X Lion. I built ImageMagick in various ways (official binary package, Homebrew, traditional ./configure && make), but it crashed for every trial.

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x00000000009a7638
0x000000010149a8d1 in MagickReadImage ()

Not only for MagickReadImage() function, IsMagickWand() function also crashes. I only guess NewMagickWand() returns a wrong pointer, or ctypes in Mac handles pointers incorrectly, but I’m not sure.

What’s wrong in this situation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:50:30+00:00Added an answer on May 26, 2026 at 9:50 am

    Most likely this is a 32/64 bit issue. Is the Mac version the only 64 bit process that you’ve tested? Or perhaps you got lucky in the Windows and Linux versions in that they happen to return pointers of the form 0x00000000xxxxxxxx.

    wand = lib.NewMagickWand()
    

    NewMagickWand returns a pointer but you have not told ctypes to expect a pointer. As it stands ctypes defaults to a 32 bit integer for the return value. Add this line before you call NewMagickWand.

    lib.NewMagickWand.restype = c_void_p
    

    This tells ctypes that NewMagickWand returns a pointer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have here a simple image converter code using Magick++(ImageMagick interface) library.(Eclipse IDE) #include
I created an application using Imagemagick library with Qt on Mac. Now that I
i am using Imagemagick for converting my .pdf file to .png images but when
I'm trying to figure whats wrong with some autogenerated (with Pyste) boost::python code, but
I am using locally the ImageMagick library for image editing. In my online shared
I am using ImageMagick with animated gifs but it is very slow. Taking twenty
I'm currently using ImageMagick to determine the size of images uploaded to the website.
Using PyObjC , you can use Python to write Cocoa applications for OS X.
I am trying to use the unmanaged ImageMagick library in my ASP.NET application from
anyone know of a free open-source jpeg encoding library for C/C++? Currently I'm using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.