Inkscape-JPEG-export-extension icon indicating copy to clipboard operation
Inkscape-JPEG-export-extension copied to clipboard

no jpg pexport in Linux

Open kzoli429 opened this issue 9 years ago • 9 comments

  • Extension does not export any file in Linux (maybe due to different path format?)
  • It should pick up the name of the svg file as default for jpg export
  • Export file location must be selected in GUI otherwise using the extension becomes more complex than simply exporting as png / convert / delete in a file browser by any other helper

kzoli429 avatar Feb 23 '16 09:02 kzoli429

Hi @kzoli429, thanks for your suggestions.

I will try to answer to your points in order:

  • Extension has been developed for my linux box, so it should export in linux (in my ubuntu, debian and mint computers it works), so if it is not exporting for you it must be some sort of bug. Can you provide more details? Any error messages?
  • The extension can export the whole svg but also single components or selections, so I don't think it is wise to use the svg name. If you look to the standard png export you will notice that it does not suggest the file name to be equal to the svg name but it uses the single object name as default (eg rect37849.png).
  • In the inkscape extension api (as far as I know) there is no way to have a file selection dialog (look to the core extensions and you will see that no one has a file dialog), so it is not possible to do that.

giacmir avatar Feb 23 '16 09:02 giacmir

Hi,

  • I use an uptodate 64 bit version of Arch Linux. I provide a full path with filename for your extension, still no output file and no error message. It seems to be OK when running, but no output.
  • My idea is obviously different. I also feel sorry for the way of naming for png export.
  • Sorry to learn. Regards, kzoli429

On 02/23/2016 10:56 AM, Giacomo Mirabassi wrote:

Hi @kzoli429 https://github.com/kzoli429, thanks for your suggestions.

I will try to answer to your points in order:

  • Extension has been developed for my linux box, so it should export in linux (in my ubuntu, debian and mint computers it works), so if it is not exporting for you it must be some sort of bug. Can you provide more details? Any error messages?
  • The extension can export the whole svg but also single components or selections, so I don't think it is wise to use the svg name. If you look to the standard png export you will notice that it does not suggest the file name to be equal to the svg name but it uses the single object name as default (eg rect37849.png).
  • In the inkscape extension api (as far as I know) there is no way to have a file selection dialog (look to the core extensions and you will see that no one has a file dialog), so it is not possible to do that.

— Reply to this email directly or view it on GitHub https://github.com/giacmir/Inkscape-JPEG-export-extension/issues/8#issuecomment-187630413.

kzoli429 avatar Feb 24 '16 11:02 kzoli429

This extension requires that there is the convert command in path. Do you have imagemagick installed?

giacmir avatar Feb 24 '16 16:02 giacmir

sure

On 02/24/2016 05:16 PM, Giacomo Mirabassi wrote:

This extension requires that there is the |convert| command in path. Do you have imagemagick installed?

— Reply to this email directly or view it on GitHub https://github.com/giacmir/Inkscape-JPEG-export-extension/issues/8#issuecomment-188328861.

kzoli429 avatar Feb 24 '16 20:02 kzoli429

Can you please try this?

  • open inskcape
  • draw a square
  • select it
  • run jpegexport plugin (specify an output path including file name, leave the rest as default)

Then please tell me if:

  • the jpeg file was created (maybe it's a problem with a specific object type)
  • there is a jpinkexp.png file in /tmp

Thank you

giacmir avatar Feb 27 '16 10:02 giacmir

No answer in 6 months, closing.

giacmir avatar Aug 26 '16 12:08 giacmir

Hello, I run into the same issue, the image went to /tmp instead of the specified path. The image is called jpinkexp.png I do have image magick installed.

command works. convert -quality 100 -density 90 source.png destination.jpg

kevinsmia1939 avatar Apr 18 '19 14:04 kevinsmia1939

Hi, on windows just install ImageMagick and edit the jpegexport.py. i did some minimal changes:

    def tojpeg(self,outfile):
        tmp = self.getTmpPath()
        if os.name == 'nt':
	        outfile = outfile.encode('string-escape')

        # set the ImageMagick command to run based on what's installed
        if find_executable('magick'):
            command = "magick \"%sjpinkexp.png\" -sampling-factor 4:4:4 -strip -interlace JPEG -colorspace RGB -quality %s -density %s \"%s\" " % (tmp, self.options.quality, self.options.density, outfile)
            # inkex.debug(command)
        elif find_executable('convert'):
            command = "convert \"%sjpinkexp.png\" -sampling-factor 4:4:4 -strip -interlace JPEG -colorspace RGB -quality %s -density %s \"%s\" " % (tmp, self.options.quality, self.options.density, outfile)
            # inkex.debug(command)
        else:
            inkex.errormsg(_('ImageMagick does not appear to be installed.'))
            exit()
            
        p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        return_code = p.wait()
        f = p.stdout
        err = p.stderr
        # inkex.debug(return_code)

    def getTmpPath(self):
        """Define the temporary folder path depending on the operating system"""
        if os.name == 'nt':
            return os.getenv('TEMP') + '\\'
        else:
            return '/tmp/'

At first i had problems but now i works like exspected

vmario89 avatar Oct 28 '19 18:10 vmario89

Thanks a lot @vmario89 for this patch. You should send a PR with this for Windows.

ankitdbst avatar Jan 20 '20 08:01 ankitdbst