User avatar
Mettauk
Posts: 235
Joined: Mon Dec 10, 2012 12:40 pm
Location: Zarg

Embedding text and the degree symbol °

Tue Jul 09, 2019 12:39 pm

Wondering if its possible to embed the degree symbol ° in stills and video?
As humans we have been the same for a very very long time, technology changes how we do... not who we are as people.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7135
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Embedding text and the degree symbol °

Tue Jul 09, 2019 1:10 pm

If you can find it present in the standard ASCII table between 32 and 126, then you can use it.
https://www.asciitable.com/
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
Mettauk
Posts: 235
Joined: Mon Dec 10, 2012 12:40 pm
Location: Zarg

Re: Embedding text and the degree symbol °

Tue Jul 09, 2019 1:29 pm

So that's a no then :cry:
Thanks for responding so quickly
As humans we have been the same for a very very long time, technology changes how we do... not who we are as people.

User avatar
PeterO
Posts: 4942
Joined: Sun Jul 22, 2012 4:14 pm

Re: Embedding text and the degree symbol °

Tue Jul 09, 2019 1:35 pm

6by9 wrote:
Tue Jul 09, 2019 1:10 pm
If you can find it present in the standard ASCII table between 32 and 126, then you can use it.
https://www.asciitable.com/
No utf-8 then ?
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7135
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Embedding text and the degree symbol °

Tue Jul 09, 2019 1:41 pm

PeterO wrote:
Tue Jul 09, 2019 1:35 pm
6by9 wrote:
Tue Jul 09, 2019 1:10 pm
If you can find it present in the standard ASCII table between 32 and 126, then you can use it.
https://www.asciitable.com/
No utf-8 then ?
PeterO
No.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

gordon77
Posts: 4111
Joined: Sun Aug 05, 2012 3:12 pm

Re: Embedding text and the degree symbol °

Tue Jul 09, 2019 2:03 pm

I managed it on stills using pygame...

Code: Select all

#!/usr/bin/env python3
import os, subprocess
import pygame, sys
from pygame.locals import *
windowSurfaceObj = pygame.display.set_mode((2592,1944),0, 24)
pygame.init()

# take a photo with the pi camera
rpistr = "raspistill -n -o test.jpg -t 2000"
p = subprocess.Popen(rpistr, shell=True, preexec_fn=os.setsid)

#load the picture
image = pygame.image.load('test.jpg')
catSurfaceObj = image
windowSurfaceObj.blit(catSurfaceObj, (0, 0))

# add text
fontObj =       pygame.font.Font('freesansbold.ttf', 50)
msgSurfaceObj = fontObj.render("test" + u"\u00b0", False, (255,255,255))
msgRectobj =    msgSurfaceObj.get_rect()
msgRectobj.topleft = (10, 10)
windowSurfaceObj.blit(msgSurfaceObj, msgRectobj)
pygame.display.update()
# save picture
pygame.image.save(windowSurfaceObj, 'test2.jpg')
Attachments
degrees.jpg
degrees.jpg (6.21 KiB) Viewed 224 times

Return to “Camera board”