sksamuel / scrimage

JVM - Java, Kotlin, Scala image processing library
https://sksamuel.github.io/scrimage
Apache License 2.0
1.07k stars 140 forks source link

ARM (M1/M2) support for WEBP #276

Closed mipastgt closed 1 year ago

mipastgt commented 1 year ago

Hi, as Intel macs have practically reached their end of life, it would be nice if you could add support for the new ARM (M1/M2) macs to the WEBP support. Thanks Michael

sksamuel commented 1 year ago

I don't use a mac. Do you have a link for details?

On Fri, Sep 1, 2023, 4:02 AM Michael Paus @.***> wrote:

Hi, as Intel macs have practically reached their end of life, it would be nice if you could add support for the new ARM (M1/M2) macs to the WEBP support. Thanks Michael

— Reply to this email directly, view it on GitHub https://github.com/sksamuel/scrimage/issues/276, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFVSGUNH2KF4NRCDU33Q7DXYGQBVANCNFSM6AAAAAA4HIF27I . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mipastgt commented 1 year ago

Googles tools for WEBP support can be downloaded here and I think that are the ones you are using internally too. You would just have to download the binaries for M1/M2 macs there and add them to your resources. Maybe you have to add something to your native lib extraction code too, so you can find and load these additional libs. Otherwise this should work out of the box. I also still don't have an ARM mac but if you deliver software people are more and more asking for M1/M2 support. (On Intel macs your code works like a charm. I have tested that.)

sksamuel commented 1 year ago

So Download for macOS (arm64) is what we need ?

mipastgt commented 1 year ago

Yes.

sksamuel commented 1 year ago

I've released 4.0.40 with support, but it's not automatic. You need to set a system property - I've updated the docs. In a future minor release I will flip mac-arm64 to be the default.

mipastgt commented 1 year ago

Wouldn't it be better to just use the standard Java properties to find out which version to use?

       //Operating system name
        System.out.println("Your OS name -> " + System.getProperty("os.name"));

        //Operating system version
        System.out.println("Your OS version -> " + System.getProperty("os.version"));

        //Operating system architecture
        System.out.println("Your OS Architecture -> " + System.getProperty("os.arch"));
sksamuel commented 1 year ago

Possibly, wasn't sure what the values are. I'm using constants for the OS but not the arch.

mipastgt commented 1 year ago

You could do it like they do it in sqlite-jdbc which contains a lot of different binaries for different platforms and architectures. https://github.com/xerial/sqlite-jdbc/blob/master/src/main/java/org/sqlite/util/OSInfo.java

sksamuel commented 1 year ago

What does System.getProperty("os.arch") print out on your m1 machine ?

On Mon, 18 Sept 2023 at 02:29, Michael Paus @.***> wrote:

You could do it like they do it in sqlite-jdbc which contains a lot of different binaries for different platforms and architectures.

https://github.com/xerial/sqlite-jdbc/blob/master/src/main/java/org/sqlite/util/OSInfo.java

— Reply to this email directly, view it on GitHub https://github.com/sksamuel/scrimage/issues/276#issuecomment-1722881751, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFVSGU4LZD35BZPTC7OXF3X27Z6FANCNFSM6AAAAAA4HIF27I . You are receiving this because you modified the open/close state.Message ID: @.***>

mipastgt commented 1 year ago

I don't own an M1/M2 mac myself yet but according to other sources it is "aarch64".

sksamuel commented 1 year ago

Looks like arm from here:

https://github.com/xerial/sqlite-jdbc/blob/master/src/main/java/org/sqlite/util/OSInfo.java#L239-L241C25

sksamuel commented 1 year ago

This agrees with you, https://stackoverflow.com/questions/66410522/value-of-system-getpropertyos-arch-on-m1-mac I'll check for both.

mipastgt commented 1 year ago

"arm" is reported by some other platforms (I have seen raspis) but not the mac.

sksamuel commented 1 year ago

Yeah I'm combining it with "is mac"

On Mon, 18 Sept 2023 at 04:54, Michael Paus @.***> wrote:

"arm" is reported by some other platforms (I have seen raspis) but not the mac.

— Reply to this email directly, view it on GitHub https://github.com/sksamuel/scrimage/issues/276#issuecomment-1723088301, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFVSGVZFUPOBMNE4SF5YELX3AK5NANCNFSM6AAAAAA4HIF27I . You are receiving this because you modified the open/close state.Message ID: @.***>