non square cover art?

Third-party modifications and add-ons, Apps and Clients

Moderator: moderators

non square cover art?

Postby cody_r_d » Sat May 07, 2011 7:55 pm

is there any way to change "coverArtSize" to give you a desired width and height?

I see in the coverArt.jsp there is a section that says


coverArtSize: Height and width of cover art.



But I cant seem to get it to work.

Any advice?
cody_r_d
 
Posts: 16
Joined: Tue Apr 19, 2011 8:39 pm
Location: Fresno CA

Postby cody_r_d » Tue May 10, 2011 8:31 pm

I still have not figured this out.. Im wondering if I have to change the ${size} variable in the line below

<div style="width:${size}; max-width:${size}; height:${size}; max-height:${size}" title="${param.albumName}">


Any ideas?

Thanks
cody_r_d
 
Posts: 16
Joined: Tue Apr 19, 2011 8:39 pm
Location: Fresno CA

Postby cody_r_d » Wed May 18, 2011 9:59 pm

Still no luck.. maybe if I explain what I'm trying to do. I have about 250-350 audio books and I'm using Safari and iSub on my iPad to listen to them. Its working well but the cover art is just driving me nuts. I really want it to be more like a book size and not a CD cover square. Does anyone have any suggestions on accomplishing this?

Thanks
cody_r_d
 
Posts: 16
Joined: Tue Apr 19, 2011 8:39 pm
Location: Fresno CA

Postby cody_r_d » Sun Jun 26, 2011 8:05 pm

Im looking into this again. I am willing to paypal the first person that can get this working for me $50. Thats how much I really want to clean up my audio book section. All I want is to have a Height and Width adjustments to the cover art with in Subsonic.. Any takers?

I will paypal $50 bucks to the first person to get this working for me. I just recently found that JAVA just is not a language for me and I'll stick with Objective C.
cody_r_d
 
Posts: 16
Joined: Tue Apr 19, 2011 8:39 pm
Location: Fresno CA

Re: non square cover art?

Postby ytechie » Thu Nov 17, 2011 9:49 pm

Well I am currently looking to have the album art adjust to the frame size to accommodate different monitor layouts. I have been able to change the overall size, but it still keeps it as a square. You have to tweak the parameter in the home.jsp file. I am looking into it right now. Hope to figure this one out!
User avatar
ytechie
 
Posts: 547
Joined: Sun Dec 12, 2010 5:05 am
Location: Manhattan, New York

Re: non square cover art?

Postby BKKKPewsey » Thu Nov 17, 2011 10:23 pm

I may be missing the point here but in my web browser (chrome) non-square album art is displayed correctly eg non-square

Image

:?
Everyone is entitled to be stupid, Image but some abuse the privilege!

Due to the confusion from too many genres of music, we have decided to put both country music and rap music into the genre of Crap music.
User avatar
BKKKPewsey
 
Posts: 2080
Joined: Mon May 23, 2011 12:16 pm
Location: United Kingdom

Re: non square cover art?

Postby fventura03 » Sat Nov 19, 2011 7:29 pm

I think they mean on the home screen, would be a nice touch...

Image
fventura03
 
Posts: 12
Joined: Tue Sep 20, 2011 12:22 pm

Re: non square cover art?

Postby felldownawell » Sat Nov 19, 2011 8:42 pm

for me, it's the exact opposite. i get the correct dimensions on the home page and a squared image on the individual album page
felldownawell
 
Posts: 3
Joined: Sat Nov 19, 2011 8:39 pm

Re: non square cover art?

Postby cody_r_d » Wed Feb 01, 2012 10:37 pm

Has anyone been able to figure this out yet to have non-square art on the home screen? I know its a small problem but I just hate seeing all my audio books streached out like that. Thanks
cody_r_d
 
Posts: 16
Joined: Tue Apr 19, 2011 8:39 pm
Location: Fresno CA

Re: non square cover art?

Postby niz5000 » Sat Feb 25, 2012 12:53 am

I have noticed that it squashes out my 1000x1500 covers to square, yet it keeps the original aspect of my 400x572 covers. Yet when it does keep the original aspect, the image covers up the text links that are supposed to be underneath it.
niz5000
 
Posts: 4
Joined: Thu Feb 16, 2012 5:08 am

Re: non square cover art?

Postby bvalentin » Mon Jul 29, 2013 5:03 pm

I have checked the Java class that scales the images (CoverArtController.java). The implemented algorithm is quite weird and indeed may produce strange results. For example, the behavior is different if the image is horizontal or vertical.

In the case of the original size of 400x572, it works fine because the width is 100px multiplied by a power of 2 and the height is bigger than the width.

Anyway, here is an adapted version that should work in all cases:

Code: Select all
    public static BufferedImage scale(BufferedImage image, int width, int height) {
        int w = image.getWidth();
        int h = image.getHeight();
        BufferedImage thumb = image;

        // For optimal results, use step by step bilinear resampling - halfing the size at each step.
        do {
            w /= 2;
            h /= 2;
            if ((w < width) && (h < height)) {
                // The new size fits entirely into the target size
                if (1.0*w/width > 1.0*h/height) {
                    h =(int) (1.0 * h / w * width);
                    w = width;
                } else {
                    w =(int) (1.0 * w / h * height);
                    h = height;
                }
            }
            BufferedImage temp = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
            Graphics2D g2 = temp.createGraphics();
            g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                    RenderingHints.VALUE_INTERPOLATION_BILINEAR);
            g2.drawImage(thumb, 0, 0, temp.getWidth(), temp.getHeight(), null);
            g2.dispose();

            thumb = temp;
        } while ((w != width)&&(h != height));

        return thumb;
    }
bvalentin
 
Posts: 1
Joined: Mon Jul 29, 2013 4:31 pm

Re: non square cover art?

Postby scooter1556 » Sat Aug 03, 2013 12:59 pm

This code should also work and make sure that the image is the maximum size it can be whilst maintaining aspect ratio.

Code: Select all
   
public static BufferedImage scale(BufferedImage image, int width, int height) {
        int w = image.getWidth();
        int h = image.getHeight();
        float multiplier = 0;
        BufferedImage thumb = image;

        if (h > height)
        {
            multiplier = ((float)height / (float)h);
            h = height;
            w = (int)(w * multiplier);
        }
       
        if (w > width)
        {
            multiplier = ((float)width / (float)w);
            w = width;
            h = (int)(h * multiplier);
        }
       
        BufferedImage temp = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = temp.createGraphics();
        g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
        g2.drawImage(thumb, 0, 0, temp.getWidth(), temp.getHeight(), null);
        g2.dispose();
        thumb = temp;

        return thumb;
    }
scooter1556
 
Posts: 3
Joined: Tue Feb 21, 2012 1:15 pm

Re: non square cover art?

Postby scooter1556 » Sun Aug 04, 2013 10:42 pm

As a side note, before the above code will take effect on existing media the 'thumbs' directory in the Subsonic installation folder will need to be deleted to clear the image cache. On Linux that directory is '/var/subsonic/thumbs'. To complete the process, clear your browser cache and Subsonic will begin creating thumbnails from scratch with the new code.
scooter1556
 
Posts: 3
Joined: Tue Feb 21, 2012 1:15 pm

Re: non square cover art?

Postby cody_r_d » Wed Oct 30, 2013 7:47 pm

I just wanted to say thanks to bvalentin and scooter1556. for some reason I never got the email notification that someone posted to this thread. I will test this out tonight and get back if all works.

Thanks again.
cody_r_d
 
Posts: 16
Joined: Tue Apr 19, 2011 8:39 pm
Location: Fresno CA

Re: non square cover art?

Postby felldownawell » Wed May 07, 2014 4:31 pm

scooter1556 wrote:This code should also work and make sure that the image is the maximum size it can be whilst maintaining aspect ratio.

Code: Select all
   
public static BufferedImage scale(BufferedImage image, int width, int height) {
        int w = image.getWidth();
        int h = image.getHeight();
        float multiplier = 0;
        BufferedImage thumb = image;

        if (h > height)
        {
            multiplier = ((float)height / (float)h);
            h = height;
            w = (int)(w * multiplier);
        }
       
        if (w > width)
        {
            multiplier = ((float)width / (float)w);
            w = width;
            h = (int)(h * multiplier);
        }
       
        BufferedImage temp = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = temp.createGraphics();
        g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
        g2.drawImage(thumb, 0, 0, temp.getWidth(), temp.getHeight(), null);
        g2.dispose();
        thumb = temp;

        return thumb;
    }


Thanks so much for the code bvalentin and scooter1556.

Can anyone assist with guidance on implementation of this on a Windows box. I've pulled coverartcontroller.class into an editor, adjusted the code in the corresponding .java, saved it, and killed the thumbs folder. I'm sure I'm just being dense, but I have not worked with editing java class files before.

Thanks.
felldownawell
 
Posts: 3
Joined: Sat Nov 19, 2011 8:39 pm


Return to Mods, Apps and Clients

Who is online

Users browsing this forum: No registered users and 22 guests