IMB_ibImageFromMemory: unknown fileformat?

Posted by Antoni4040 on Stack Overflow See other posts from Stack Overflow or by Antoni4040
Published on 2012-10-31T16:00:59Z Indexed on 2012/11/01 17:01 UTC
Read the original article Hit count: 345

Filed under:
|
|
|

Here's my add-on:

import bpy
import os
import sys
import subprocess
import threading

class ExportToGIMP(bpy.types.Operator):
    bl_idname = "uv.exporttogimp"
    bl_label = "Export to GIMP"

    def execute(self, context):
        self.filepath = os.path.join(os.path.dirname(bpy.data.filepath), "Layout")
        bpy.ops.uv.export_layout(filepath=self.filepath, check_existing=True, export_all=False, modified=False, mode='PNG', size=(1024, 1024), opacity=0.25, tessellated=False)
        self.files = os.path.dirname(bpy.data.filepath)
        cmd = " (python-fu-bgsync RUN-NONINTERACTIVE)"
        subprocess.Popen(['gimp', '-b', cmd])
        self.update()
        return {'FINISHED'};

    def update(self):
        self.thread = threading.Timer(3.0, self.update).start()
        self.filepath2 = "/home/antoni4040/????afa/Layout1.png"
        bpy.ops.image.open(filepath=self.filepath2, filter_blender=False, filter_image=True, filter_movie=False, filter_python=False, filter_font=False, filter_sound=False, filter_text=False, filter_btx=False, filter_collada=False, filter_folder=True, filemode=9, relative_path=False)                
        tex = bpy.data.textures.new(name = self.filepath2, type = "IMAGE")

def exporttogimp_menu(self, context):
    self.layout.operator(ExportToGIMP.bl_idname, text="Export To GIMP")

bpy.utils.register_class(ExportToGIMP)
bpy.types.IMAGE_MT_uvs.append(exporttogimp_menu)

But I can't load an image, because I get this:

Reached EOF while decoding PNG
IMB_ibImageFromMemory: unknown fileformat (/home/antoni4040/????afa/Layout1.png)

What is that?

© Stack Overflow or respective owner

Related posts about python

Related posts about file-format