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

python image.tostring("jpeg") fails with 'palette unsupported' error #896

Closed
artemp opened this issue Oct 11, 2011 · 1 comment
Closed

Comments

@artemp
Copy link
Member

artemp commented Oct 11, 2011

After upgrading the OSM tile server to mapink-2.0.0 the export script started returning the error below:
{{{
Traceback (most recent call last):
File "/usr/lib/cgi-bin/export", line 135, in
jpeg = image.tostring("jpeg")
RuntimeError: palettes are not currently supported when writing to jpeg format
}}}
This seems to fix it by removing the unnecessary empty palette from tostring2:
{{{
--- ./bindings/python/mapnik_image.cpp~ 2011-09-26 11:30:24.000000000 +0100
+++ ./bindings/python/mapnik_image.cpp 2011-10-02 18:06:18.000000000 +0100
@@ -79,8 +79,7 @@
// encode (png,jpeg)
PyObject* tostring2(image_32 const & im, std::string const& format)
{

  • mapnik::rgba_palette pal;
  • std::string s = save_to_string(im, format, pal);
  • std::string s = save_to_string(im, format);
    return
    #if PY_VERSION_HEX >= 0x03000000
    ::PyBytes_FromStringAndSize
    }}}
    A similar fix is probably required for image views in view_tostring2
@artemp
Copy link
Member Author

artemp commented Oct 11, 2011

[artem] Applied in r3370.
Thanks, Jon.

@artemp artemp closed this as completed Oct 11, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant