Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

no jpg pexport in Linux #8

Open
kzoli429 opened this issue Feb 23, 2016 · 9 comments
Open

no jpg pexport in Linux #8

kzoli429 opened this issue Feb 23, 2016 · 9 comments

Comments

@kzoli429
Copy link

  • 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
@giacmir
Copy link
Owner

giacmir commented Feb 23, 2016

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.

@kzoli429
Copy link
Author

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
#8 (comment).

@giacmir
Copy link
Owner

giacmir commented Feb 24, 2016

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

@kzoli429
Copy link
Author

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
#8 (comment).

@giacmir
Copy link
Owner

giacmir commented Feb 27, 2016

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
Copy link
Owner

giacmir commented Aug 26, 2016

No answer in 6 months, closing.

@giacmir giacmir closed this as completed Aug 26, 2016
@kevinsmia1939
Copy link

kevinsmia1939 commented Apr 18, 2019

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

@giacmir giacmir reopened this Apr 26, 2019
@vmario89
Copy link

vmario89 commented Oct 28, 2019

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

@ankitdbst
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants