Box cover art image resizing

Discussion in 'Wii - Hacking' started by schnitzelbrain, Apr 12, 2009.

Apr 12, 2009
  1. schnitzelbrain

    Newcomer schnitzelbrain Advanced Member

    Apr 11, 2009

    first i am not a C/C++ coder, i stick mor to the VB Side.

    But when I locked through the threads about the usb loader develops there are certian cpmpains about a not resizeable image of the cover art.
    now, in the pngu.c there is the following part:

    int PNGU_DecodeToYCbYCr (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride)
    int result;
    PNGU_u32 x, y, buffWidth;

    // width needs to be divisible by two
    if (width % 2)
    return PNGU_ODD_WIDTH;

    // stride needs to be divisible by two
    if (stride % 2)
    return PNGU_ODD_STRIDE;

    result = pngu_decode (ctx, width, height, 1);
    if (result != PNGU_OK)
    return result;

    // Copy image to the output buffer
    buffWidth = (width + stride) / 2;
    for (y = 0; y < height; y++)
    for (x = 0; x < (width / 2); x++)
    ((PNGU_u32 *)buffer)[y*buffWidth+x] = PNGU_RGB8_TO_YCbYCr (*(ctx->row_pointers[y]+x*6), *(ctx->row_pointers[y]+x*6+1), *(ctx->row_pointers[y]+x*6+2),
    *(ctx->row_pointers[y]+x*6+3), *(ctx->row_pointers[y]+x*6+4), *(ctx->row_pointers[y]+x*6+5));

    // Free resources
    free (ctx->img_data);
    free (ctx->row_pointers);

    // Success
    return PNGU_OK;

    What is to output the image to the output buffer.

    Would there be a resize way if we let the loops count up for a step of two instead of one ? There would be every second line and every second pixel in the output, correct ?
    That would then cut the image to 50% size.

    Just ignore me if this is wrong or drop a note whats wrong maybe.

Share This Page