Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8287927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:10:16+00:00 2026-06-08T12:10:16+00:00

i have a 128×128 array of elevation data (elevations from -400m to 8000m are

  • 0

i have a 128×128 array of elevation data (elevations from -400m to 8000m are displayed using 9 colors) and i need to resize it to 512×512. I did it with bicubic interpolation, but the result looks weird. In the picture you can see original, nearest and bicubic. Note: only the elevation data are interpolated not the colors themselves (gamut is preserved). Are those artifacts seen on the bicubic image result of my bad interpolation code or they are caused by the interpolating of discrete (9 steps) data?

https://i.stack.imgur.com/Qx2cl.png

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T12:10:17+00:00Added an answer on June 8, 2026 at 12:10 pm

    There must be something wrong with the bicubic code you’re using. Here’s my result with Python:

    Bicubic resize

    The black border around the outside is where the result was outside of the palette due to ringing.

    Here’s the program that produced the above:

    from PIL import Image
    im = Image.open(r'c:\temp\temp.png')
    
    # convert the image to a grayscale with 8 values from 10 to 17
    levels=((0,0,255),(1,255,0),(255,255,0),(255,0,0),(255,175,175),(255,0,255),(1,255,255),(255,255,255))
    img = Image.new('L', im.size)
    iml = im.load()
    imgl = img.load()
    colormap = {}
    for i, color in enumerate(levels):
        colormap[color] = 10 + i
    width, height = im.size
    for y in range(height):
        for x in range(width):
            imgl[x,y] = colormap[iml[x,y]]
    
    # resize using Bicubic and restore the original palette
    im4x = img.resize((4*width, 4*height), Image.BICUBIC)
    palette = []
    for i in range(256):
        if 10 <= i < 10+len(levels):
            palette.extend(levels[i-10])
        else:
            palette.extend((i, i, i))
    im4x.putpalette(palette)
    im4x.save(r'c:\temp\temp3.png')
    

    Edit: Evidently Python’s Bicubic isn’t the best either. Here’s what I was able to do by hand in Paint Shop Pro, using roughly the same procedure as above.

    Bicubic in Paint Shop Pro

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CryptoAPI code to encrypt\ decrypt given data using AES-128 and a
I have a 128-byte (1024-bit) modulus (in a byte array format) and my exponent
I have an array of ints like this: [32,128,1024,2048,4096] Given a specific value, I
I need a CORE that will perform AES-128 Encryption/Decryption. I have searched online but
I'm using MySQL. This is table i have Level Programmingtime Clientname projectid 0 128
I have a need to mirror a byte's value around the centre of 128.
I have an array result that contains values from 0-255. I originally declared it
I'm using scrapy to extract data from a web site. I'm saving the data
I have a problem with using hash function. I have to assign some number(128
I have written a small example C++ program, using boost::thread. Since it's 215 lines,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.