First of all, don't do it! Make your own graphics and your game will feel all the better for it. Games using ripped graphics rarely gain positive reviews.
- For Sierra games such as Space Quest, there is a program called SCI Studio (again, not easily obtained), which allows you to extract resources from older games. Note that using ripped graphics in your game is breaching copyright, and Sierra may well tell you to cease and desist.
- For AGS games, there is no resource extractor. People have worked long and hard on their games, and generally won't appreciate you stealing their graphics. If you want to use someone else's graphics, send them an e-mail and ask permission - they might send you the source image files, you never know.