{"id":13413199,"url":"https://github.com/gographics/imagick","last_synced_at":"2025-05-14T04:04:01.358Z","repository":{"id":37405953,"uuid":"9776211","full_name":"gographics/imagick","owner":"gographics","description":"Go binding to ImageMagick's MagickWand C API","archived":false,"fork":false,"pushed_at":"2024-12-16T22:14:15.000Z","size":4660,"stargazers_count":1815,"open_issues_count":3,"forks_count":186,"subscribers_count":54,"default_branch":"master","last_synced_at":"2025-04-29T05:36:31.113Z","etag":null,"topics":["go","golang","imagemagick","imagemagick-magickwand","imagick","magickwand"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/gographics/imagick/imagick","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gographics.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-04-30T17:31:48.000Z","updated_at":"2025-04-19T09:38:29.000Z","dependencies_parsed_at":"2022-07-08T17:47:58.428Z","dependency_job_id":"6f6bfafa-6eac-44b2-b6b9-de35a446ac4b","html_url":"https://github.com/gographics/imagick","commit_stats":{"total_commits":242,"total_committers":27,"mean_commits":8.962962962962964,"dds":0.640495867768595,"last_synced_commit":"fb2c7f301793ada99eb5c1e3774767c76bb2c3d9"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gographics%2Fimagick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gographics%2Fimagick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gographics%2Fimagick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gographics%2Fimagick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gographics","download_url":"https://codeload.github.com/gographics/imagick/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253436277,"owners_count":21908292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","imagemagick","imagemagick-magickwand","imagick","magickwand"],"created_at":"2024-07-30T20:01:34.997Z","updated_at":"2025-05-14T04:04:01.291Z","avatar_url":"https://github.com/gographics.png","language":"Go","readme":"# Go Imagick\n\n[![GoDoc](https://godoc.org/gopkg.in/gographics/imagick.v2/imagick?status.svg)](https://gopkg.in/gographics/imagick.v2/imagick)\n[![Build](https://github.com/gographics/imagick/workflows/Test/badge.svg)](https://github.com/gographics/imagick/actions?query=workflow%3A%22Test%22)\n\nGo Imagick is a Go bind to ImageMagick's MagickWand C API.\n\nWe support two compatibility branches:\n\n```\nim-7   (tag v3.x.x): 7.x     \u003c= ImageMagick \u003c= 7.x\nmaster (tag v2.x.x): 6.9.1-7 \u003c= ImageMagick \u003c= 6.9.9-35\nlegacy (tag v1.x.x): 6.7.x   \u003c= ImageMagick \u003c= 6.8.9-10\n```\n\nThey map, respectively, through gopkg.in:\n\n```\ngopkg.in/gographics/imagick.v3/imagick\ngopkg.in/gographics/imagick.v2/imagick\ngopkg.in/gographics/imagick.v1/imagick\n```\n\n# Install\n\n## Docker\n\nSee [examples/docker](examples/docker)\n\n## Mac OS X\n\n```\nbrew install imagemagick\n```\n\n## Ubuntu / Debian\n\n```\nsudo apt-get install libmagickwand-dev\n```\n\n## Windows\n\n*Thanks @vprus*\n\n+ Install [msys2-x86_64](http://www.msys2.org/)\n+ In msys shell, do:\n```\npacman -Syuu\npacman -S mingw-w64-x86_64-gcc\npacman -S mingw-w64-x86_64-pkg-config\npacman -S mingw-w64-x86_64-zlib\npacman -S mingw-w64-x86_64-imagemagick\n```\n\n+ Switch to cmd.exe shell, and do:\n```\nset PATH=\u003cmsys64\u003e\\mingw64\\bin;%PATH%\nset PKG_CONFIG_PATH=\u003cmsys64\u003e\\mingw64\\lib\\pkgconfig\nset MAGICK_CODER_MODULE_PATH=\u003cmsys64\u003e\\mingw64\\lib\\ImageMagick-7.0.6\\modules-Q16HDRI\\coders\ngo build gopkg.in/gographics/imagick.v3/imagick\n```\n\nThe default installation path of `msys2` is `C:\\msys64` and you must change\n`\u003cmsys64\u003e` to your installation path of `msys2`.\n\nThe `MAGICK_CODER_MODULE_PATH` environment variable tells ImageMagick where to\nfind the decoders. If you still get the `NoDecodeDelegateForThisImageFormat`\nerror, then make sure the version number and folders are correct.\n\n## Common\n\nCheck if pkg-config is able to find the right ImageMagick include and libs:\n\n```\npkg-config --cflags --libs MagickWand\n```\n\nThen go get it:\n\n```\ngo get gopkg.in/gographics/imagick.v2/imagick\n```\n\nPer the security update https://groups.google.com/forum/#!topic/golang-announce/X7N1mvntnoU\nyou may need whitelist the -Xpreprocessor flag in your environment.\n\n```\nexport CGO_CFLAGS_ALLOW='-Xpreprocessor'\n```\n\n### Build tags\n\nIf you want to specify CGO_CFLAGS/CGO_LDFLAGS manually at build time, such as for building statically or without pkg-config, you can use the \"no_pkgconfig\" build tag:\n\n```\ngo build -tags no_pkgconfig gopkg.in/gographics/imagick.v2/imagick\n```\n\n# Examples\n\nThe examples folder is full with usage examples ported from C ones found in here: http://www.imagemagick.org/MagickWand/\n\n# Quick and partial example\n\n```go\npackage main\n\nimport \"gopkg.in/gographics/imagick.v2/imagick\"\n\nfunc main() {\n    imagick.Initialize()\n    defer imagick.Terminate()\n\n    mw := imagick.NewMagickWand()\n\n    ...\n}\n```\n## `Initialize()` and `Terminate`\n\nAs per the ImageMagick C API, `Initialize()` should be called only once to set up the resources for using ImageMagick. This is typically done in your `main()` or `init()` for the entire application or library. Applications can defer a call to `Terminate()` to tear down the ImageMagick resources.\n\nIt is an error to `Initialize` and `Terminate` multiple times in specific functions and leads to common problems such as crashes or missing delegates. Do not use `Terminate` anywhere other than the absolute end of your need for ImageMagick within the program.\n\n## Managing memory\n\nSince this is a CGO binding, and the Go GC does not manage memory allocated by the C API, it is then necessary to use the Terminate() and Destroy() methods.\n\nTypes which are created via `New*` constructors (MagickWand, DrawingWand, PixelIterator, PixelWand,...), or created and returned by methods like `Clone()` are managed by Go GC through the use of finalizers. They are not guaranteed to be cleaned up immediately after the object is not longer in use, but rather at some point later when GC actually executes its finalizers.\n\nIf you use struct literals, you should free resources manually:\n\n```go\npackage main\n\nimport \"github.com/gographics/imagick/imagick\"\n\nfunc main() {\n    imagick.Initialize()\n    defer imagick.Terminate()\n\n    mw := imagick.MagickWand{...}\n    defer mw.Destroy()\n\n    ...\n}\n```\n\nBoth methods are compatible if constructor methods used:\n\n```go\npackage main\n\nimport \"github.com/gographics/imagick/imagick\"\n\nfunc main() {\n    imagick.Initialize()\n    defer imagick.Terminate()\n\n    mw := imagick.NewMagickWand()\n    defer mw.Destroy()\n\n    ...\n}\n```\n\nBut you should NOT mix two ways of object creation:\n```go\npackage main\n\nimport \"github.com/gographics/imagick/imagick\"\n\nfunc main() {\n    imagick.Initialize()\n    defer imagick.Terminate()\n\n    mw1 := imagick.MagickWand{...}\n    defer mw1.Destroy()\n\n    mw2 := imagick.NewMagickWand()\n\n    ...\n}\n```\n\nCalling `Destroy()` on types that are either created via `New*` or returned from other functions calls forces the cleanup of the item immediately as opposed to later after garbage collection triggers the finalizer for the object. It would be good practice to explicitly call `Destroy()` to ensure C memory is freed sooner rather than later, depending on how often the GC is triggered.\n\n# License\n\nCopyright (c) 2013-2016, The GoGraphics Team\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright\n   notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright\n   notice, this list of conditions and the following disclaimer in the\n   documentation and/or other materials provided with the distribution.\n * Neither the name of the organization nor the\n   names of its contributors may be used to endorse or promote products\n   derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL HERBERT G. FISCHER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","funding_links":[],"categories":["Go","图片","Images","Images 图像处理","Repositories","图像","\u003cspan id=\"图片-images\"\u003e图片 Images\u003c/span\u003e","Relational Databases"],"sub_categories":["检索及分析资料库","Search and Analytic Databases","SQL 查询语句构建库","Advanced Console UIs","交流","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgographics%2Fimagick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgographics%2Fimagick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgographics%2Fimagick/lists"}