JCC not working (empty images)

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Message
Author
User avatar
jack_norton
Lemma-Class Veteran
Posts: 4096
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

JCC not working (empty images)

#1 Post by jack_norton »

Today decided to try JCC, ran it and generated all the jpg images. However when I try to run the game, all converted images are empty (not displayed in the game). I don't know why this happen, any clues? the jcc.rpy file obviously is there, and the files as well.
follow me on Image Image Image
computer games

User avatar
PyTom
Ren'Py Creator
Posts: 16122
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: JCC not working (empty images)

#2 Post by PyTom »

hm... can you attach a couple of the generated images? Specifically, the original png and the .mask.jpg and .base.jpg files generated for it? That will help me determine which step is going wrong.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4096
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: JCC not working (empty images)

#3 Post by jack_norton »

Well for now I just used 256 color png. For manga style art is more than enough (you don't even notice the difference) and also the size is even smaller than using JCC :)
follow me on Image Image Image
computer games

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: JCC not working (empty images)

#4 Post by Jake »

jack_norton wrote:Well for now I just used 256 color png. For manga style art is more than enough (you don't even notice the difference)
Hmm. You quite possibly wouldn't notice the difference colour-wise, presuming you're talking about cel-shading, but... surely the difference is noticable in terms of transparency? Since 24bpp PNG and JCC can do varying levels of transparency, making the edges of the sprite smooth, while 8bpp (256-colour) PNG can only do on/off transparency and thus the edges will be abrupt and pixellated?
Server error: user 'Jake' not found

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4096
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: JCC not working (empty images)

#5 Post by jack_norton »

Well I am using 1024x768 as resolution, so is barely noticeable (at least for me). For now I'm going to leave it this way, can always change it later ;)
follow me on Image Image Image
computer games

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4096
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: JCC not working (empty images)

#6 Post by jack_norton »

Ok I've found the time to upload the images. They look fine to me (mask is ok), still wonder why I get nothing displayed ??
Attachments
mask image
mask image
window1.png.mask.jpg (3.22 KiB) Viewed 2767 times
base image
base image
window1.png.base.jpg (18.84 KiB) Viewed 2766 times
follow me on Image Image Image
computer games

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4096
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: JCC not working (empty images)

#7 Post by jack_norton »

I even tried to load manually the files with:

image splash = im.AlphaMask(im.Image("gfx/logo.png.base.jpg", cache=False), im.Image("gfx/logo.png.mask.jpg", cache=False))

but still nothing is displayed. Nobody uses JCC ? I tried loading the images in my own C library and works, so must be a bug of renpy or SDL ?
follow me on Image Image Image
computer games

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4096
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: JCC not working (empty images)

#8 Post by jack_norton »

I think I found the bug in renpy:
Function: im.AlphaMask (base, mask, **properties):

base and mask should be image manipulators. This function takes the red channel from mask, and applies it to the alpha channel of base to create a new image.
the mask image is a grey JPG, so can't take the red channel I think... ?
follow me on Image Image Image
computer games

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: JCC not working (empty images)

#9 Post by Jake »

jack_norton wrote:the mask image is a grey JPG, so can't take the red channel I think... ?
All pixels in a digital image are represented as red, green and blue values - even black and white. Typically, they'll range between 0 and 255, the maximum value you can store in a single byte.

Black is the absence of all colour, so it's RGB 0/0/0; White is all colour at the same time, so it's RGB 255/255/255. A 50% neutral grey is half-way between black and white, and as such it has an RGB value half-way between, of 128/128/128 (or 127/127/127, whichever you prefer).

So yes, a greyscale image still has a red channel, it's just that the red channel, the green channel and the blue channel will be the same. I expect that the reason the function uses the red channel in particular is just that it's convenient; as it goes, frequently the red value is stored in the lowest byte of a 4-byte integer for each pixel. For a greyscale mask image, you can read that sentence instead as "This function takes the luminance value from mask, and applies it to the alpha channel of base to create a new image."
Server error: user 'Jake' not found

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4096
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: JCC not working (empty images)

#10 Post by jack_norton »

Ok, thanks for the explanation. Still it doesn't work :cry: does anybody uses JCC successfully?
follow me on Image Image Image
computer games

User avatar
PyTom
Ren'Py Creator
Posts: 16122
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: JCC not working (empty images)

#11 Post by PyTom »

It worked when I tested it, a while ago. I'll debug it when I get back home, mondayish.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
DaFool
Lemma-Class Veteran
Posts: 4171
Joined: Tue Aug 01, 2006 12:39 pm
Contact:

Re: JCC not working (empty images)

#12 Post by DaFool »

jack_norton wrote:Ok, thanks for the explanation. Still it doesn't work :cry: does anybody uses JCC successfully?
The yaruge hentai I released early this year successfully used jcc, and it's open-source in case you want to take a look (and please try to ignore the general pervertedness and crappiness of the work otherwise)

Recently I'm just making graphics, so I haven't been fresh programming-wise for a while now (my mind goes blank on technical stuff nowadays).

What I do remember is make sure the png really needs the jcc functionality, i.e. it has transparency. Otherwise, in some instances, (and in virtually all cases where there is no transparency), a straight jpeg export is more efficient. In other instances, the deterioration of the jpeg mask is apparent.

What I did was compare pngs to jcc-induced jpegs and pick the ones with the best quality/size ratio. For images that have gradual gradients (such as, ahem, milky-white substances), you can't use jcc on the pngs without introducing pixelation around the edges, so you have to keep using pngs.

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4096
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: JCC not working (empty images)

#13 Post by jack_norton »

Thanks, I'm going to check it. It uses an archive or I can extract 2 test images to check?
(even if as I said before is really strange, in my own C code the 2 jpeg made with JCC works fine! so I really don't understand the bug :lol: )
follow me on Image Image Image
computer games

Gau_Veldt
Regular
Posts: 86
Joined: Tue Jun 10, 2008 8:22 pm
Location: Prince George, BC
Contact:

Re: JCC not working (empty images)

#14 Post by Gau_Veldt »

jack_norton wrote:Thanks, I'm going to check it. It uses an archive or I can extract 2 test images to check?
(even if as I said before is really strange, in my own C code the 2 jpeg made with JCC works fine! so I really don't understand the bug :lol: )
Try making a project with a minimal script to display just the JCC'ed image. If it still doesn't work in that minimum project, zip that up and post it. Also make note of what version of Ren'Py you are using.

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4096
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: JCC not working (empty images)

#15 Post by jack_norton »

Well actually the images I posted use a minimal script :)
I'm using latest renpy. I use that image to replace the default window/buttons background, but even if I try to show a simple image on startup, doesn't work :(

Code: Select all

init:
    # Declare images below this line, using the image statement.
    image splash = im.AlphaMask(im.Image("gfx/logobase.jpg", cache=False), im.Image("gfx/logomask.jpg", cache=False))    #image splash = "gfx/logo.png"

label splashscreen:
    $ renpy.pause(0)
    scene black
    show splash at truecenter
    with dissolve 
    with Pause (1.0)
the logo images:
Attachments
logomask.jpg
logomask.jpg (11.28 KiB) Viewed 1763 times
logobase.jpg
follow me on Image Image Image
computer games

Post Reply

Who is online

Users browsing this forum: No registered users